Virtuemart flags error when adding product type or product type parameter.

Recently, one of my clients came up with an error that is showing up in Joomla + Virtuemart site, when trying to add a new “Product Type” or “Product Type Parameter”.

 

The Error is:

Error: Failed to create a new table for this Product Type!! (when adding Product Type)
Error: Adding the new parameter field to the table failed. (when adding Product Type Parameter)

 

But at the same time the work is also done in the backend successfully.

 

The site configuration is

Joomla 1.5.22

Virtuemart 1.1.8

 

Solution:

After digging deep through files and flow, I found that Virtuemart creates tables for each Parameter Type and for each of its parameters.

e.g. vm_product_type_<ID> where id the product type id in vm_product_typetable, with parameters as its fields.

 

The bug is here:

 

When the create table query is launched, it expects the table (engine) type in MySql and Virtuemart provides is by appending “TYPE=MyISAM” at the end of query. This works fine in older versions of MySQL but for new version e.g. v5.5.x and above this is expected to be “ENGINE=MyISAM”.

 

Where to Change:

 

Open file: /administrator/components/com_virtuemart/classes/ps_product_type.php.

On line 129 change :

$q .= “) TYPE=MyISAM;”;

 

To

$q .= “) ENGINE=MyISAM;”;

 

And the error is gone.

Blogs imobisoft