Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

SQL command to update weights in a category


SCH_001

Recommended Posts

Hi all, I have the need to bulk update all the weights in a category / sub category

Is there a command I can run in phpmyadmin to update the weight of all items in say category
Top » Catalog » Buggies / Trucks » 1/10th Brushless
to 3.0

Link to comment
Share on other sites

The toughest part will be coming up with the right WHERE clause to deal with just the desired category's entries. Blending category information with product data may require a few JOINs in the clause. After that, something like SET weight='3.0' should be trivial. You can play around in phpMyAdmin and see if you can come up with a SELECT statement just for the items you want, and then change it to an UPDATE statement with the SET. Depending on whether this is going to be a frequent operation or is a one-off, you might find it easier to gather the information playing in phpMyAdmin and manually build an SQL file with a bunch of updates, and import it into your database.

It would probably be a good idea to back up your database before doing any updates/writing/imports to the database.

Link to comment
Share on other sites

Hi Burt, thank you for this snippet. How do I get the categories_id number for categories and sub categories I have done some goggling but not found the answer

Quote

 

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...