News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Bug in view.json.php gives unexpected behaviour in non-standard installations

Started by stephenhare, January 28, 2014, 01:15:05 AM

Previous topic - Next topic

stephenhare

In a standard VM2 installation, there are two rows in the virtuemart_customs table, representing the type "R" (related products) and "Z" (related categories) that are two standard custom fields for products.

When migrating to VM from another e-commerce system (e.g. Prestashop) using a migration service (e.g. Cart2Cart), the _customs table can not be guaranteed to have these two lines present. When this is the case, trying to add a related product (or category) by the AJAX search box give unexpected and unpredictable behaviour.

This is because setRelatedHtml function at the end of the view.json.php file has the line:
"$customs = $this->db->loadObject(); "      and $customs is then used as a parameter in another function call, without testing to see if it exists.

There should be a test on the value of $customs to see if it exists (with an error message if not) before then going on to use it.