Jump to content

[SOLVED] SQL query to update product quantity


Recommended Posts

Hello,

 

How can i update the quantity for a list of products?

I've selected the IDs that i'm interested in modifying their quantity and i have come up with this SQL query which i've run inside the ps_product table:

UPDATE  `ps_product` SET  `quantity` =0 WHERE  `id_product` IN ( 316, 317, 318 )

The IDs 316,317,318 are the ids that i need to modify the quantity from its current value to zero.

 

The result is: 3 rows modified, but the actual quantity in BO is the same, it's not zero, as i thought it would be.

 

How can i achieve my goal?

Please see attached picture to see the place i need zero quantity.

post-42763-0-83389200-1400449623_thumb.png

Edited by vekia (see edit history)
Link to comment
Share on other sites

  • 1 month later...
  • 1 year later...
  • 2 years later...
  • 5 months later...
On 5/19/2014 at 9:12 PM, vekia said:

you're welcome 🙂

glad ot hear that i could help a little

i marked topic title as solved.

with regards,

Milos

How can I do the same, but for all the products? I want 1 as quantity for all the products.

The query is:?

UPDATE  `ps_stock_available` SET  `quantity` =1

 

Edited by Sasha Chirico
SQL Code (see edit history)
Link to comment
Share on other sites

  • 4 years later...

I got a table  (lanix) with: quantity , price, reference,  id_product (null if if it's not in my erp)

So this do quantity and price update:

  • UPDATE psso_product INNER JOIN psso_lanix ON psso_product.id_product = psso_lanix.id_product SET psso_product.price = psso_lanix.price, psso_product.quantity = psso_lanix.quantity;
  • UPDATE psso_product INNER JOIN psso_product_shop ON psso_product.id_product = psso_product_shop.id_product SET psso_product_shop.price = psso_product.price;
  • UPDATE psso_stock_available INNER JOIN psso_product ON psso_stock_available.id_product = psso_product.id_product SET psso_stock_available.quantity = psso_product.quantity;

Can be more efficient but, i need to know which products in my ERP are not sync so in lanix.id_product null means product not in prestashop.


 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...