Modifying a field in the products table

How to modify a field in the products table

To modify a field to make it longer, use the SQL ALTER TABLE command. Just be sure you also modify the other copies of the field which may exist in other tables, such as the orders_products table.

As an example, here’s how to modify the products_model field in the products table:

Make a backup of your database. Then in phpMyAdmin:

ALTER TABLE orders_products MODIFY COLUMN products_model varchar(40) default NULL;

ALTER TABLE products MODIFY COLUMN products_model varchar(40) default NULL;

(The value 40 could be whatever you want but it should be the same in both.)

If your database uses a prefix, you must use it on those two table names (e.g. ALTER TABLE zen_orders_products, ALTER TABLE zen_products).

Still have questions? Use the Search box in the upper right, or try the full list of FAQs. If you can't find it there, head over to the Zen Cart support forum and ask there in the appropriate subforum. In your post, please include your Zen Cart and PHP versions, and a link to your site.

Is there an error or omission on this page? Please post to General Questions on the support forum. Or, if you'd like to open a pull request, just review the guidelines and get started. You can even PR right here.
Last modified December 3, 2022 by Scott C Wilson (6c2f436).