Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Add weight to all products in category


backpacker

Recommended Posts

Hi,

 

I have been googleing and searching but didn't find any solution to this problem. How can I add weight to all products in category? For example Category X's all products weight 4 kilograms, but there are hundreds of products in the category, so there must be an easier way than just adding the weight one at a time.

 

SQL!

 

I'm not very experienced with SQL and Oscommerce database is really new to me. I don't want to destroy all the tables by accident :blush:

 

Could anyone help me with the (simple) sql query I need to add the weight Y.zz to all products in category X?

 

update products WHERE category = 'X' set products_weight = '4.00'

 

I know it goes something like that...

Link to comment
Share on other sites

Could anyone help me with the (simple) sql query I need to add the weight Y.zz to all products in category X?

Since the categories_id for a product is stored in another table that particular query is not possible. Before you try this make sure you have a backup of your site:

 

update products p, products_to_categories p2c set products_weight = 'Y.zz' where p.products_id = p2c.products_id and p2c.categories_id = 'X';

Link to comment
Share on other sites

Since the categories_id for a product is stored in another table that particular query is not possible. Before you try this make sure you have a backup of your site:

 

update products p, products_to_categories p2c set products_weight = 'Y.zz' where p.products_id = p2c.products_id and p2c.categories_id = 'X';

 

This worked great :) Thank you!

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...