chaddro / EasyPopulate-4.0

Data import and export module for Zencart 1.3.x and 1.5.x
GNU General Public License v2.0
24 stars 31 forks source link

manufacturers_id set to null in products database #3

Closed chaddro closed 12 years ago

chaddro commented 12 years ago

Came across this issue today. Old versions of EP would enter a NULL value in the products table for entries where no manufacturer is assigned. But, when you add a new product from within the zencart admin, and do not assign a manufacturer, the admin defaults this to zero.

Zero, for zencart, means no manufacturer. ID's in the manufacturer's table start at 1, not zero.

The code currently tests for '0'. If there are NULL values, this can through an error. For best compatibility, I should test for both possibilities. However, 0 is the "correct" value.

chaddro commented 12 years ago

If you have a mix of manufacturers_id set to 0 and '' (NULL) you can fix this by running this command under Tools > Install SQL Patches:

UPDATE products SET manufacturers_id= 0 WHERE manufacturers_id is null;

This will change all null values to 0.