SQL Tricks for Zen Cart

By Melanie Prough on Friday, May 13, 2011
Filed Under: Zen Cart Tips












Sometimes the tools we have just aren’t going to cut it. These little SQL patches to be run in your Zen Cart admin are just the trick to complete these items quickly and efficiently. Please backup your database before proceeding.

Lets say you want to add all products with no manufacturer assigned to manufacturer #1.

UPDATE `products` SET `manufacturers_id` = 1 WHERE `products`.`manufacturers_id` =0;

How about adding or decreasing the prices of all products belonging to a manufacturer?

UPDATE `products` SET `products_price` = ‘products_price -1.00’ WHERE `products`.`manufacturers_id` =1;

** This will reduce all prices by $1 for manufacturer #1.

How about adding or decreasing the prices of all products belonging to a specific category?

UPDATE `products` SET `products_price` = ‘products_price -1.00’ WHERE `products`.`master_categories_id` =1;

** This will reduce all prices by $1 for category#1.

How about the weight of all products?

UPDATE `products` SET `products_weight` = 1.0;

Update the weight of all products from a manufacturer?

UPDATE `products` SET `products_weight` = 1.0 WHERE `products`.`manufacturers_id` =1;

Update the weight of all products in a category?

UPDATE `products` SET `products_weight` = 1.0 WHERE `products`.`master_categories_id` =1;

How about the inventory of all products?

UPDATE `products` SET `products_quantity` = 100;

Update the inventory of all products from a manufacturer?

UPDATE `products` SET `products_quantity` = 100 WHERE `products`.`manufacturers_id` =1;

Update the inventory of all products in a category?

UPDATE `products` SET `products_quantity` = 100 WHERE `products`.`master_categories_id` =1;

**Example sets them all to 100

Have some cool SQL shortcuts for Zen Cart? Comment and share.

Tags: , , , , ,

Comments are closed.

Template Original