Our Blog

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

Imobisoft blog

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.

Sharing is caring!

Let's Get In Touch

Kick Start Your Project

Let’s chat about how we can help you. Fill in the details and we’ll get back to you as soon we can.

How To Reach Us

Our helpline is always open to receive any enquiry or feedback. Please feel free to contact us via email or use the form and we will get back to you as soon as we can.