how to update entire Category price in OpenCart
We will do this by directly updating into databases
Here are Steps to do this
1>Search Category by Name here is script
SELECT * FROM `oc_category_description` WHERE name in ("Clothing" , "Kids dresses")
2> No get Products Prices and Special price by just provide category id
SELECT pc.product_id,category_id,p.product_id,ps.product_id,p.price,ps.price FROM oc_product as p join `oc_product_to_category` as pc on pc.product_id=p.product_id JOIN`oc_product_special` as ps on p.product_id=ps.product_id WHERE pc.category_id=415
Here are Steps to do this
1>Search Category by Name here is script
SELECT * FROM `oc_category_description` WHERE name in ("Clothing" , "Kids dresses")
2> No get Products Prices and Special price by just provide category id
SELECT pc.product_id,category_id,p.product_id,ps.product_id,p.price,ps.price FROM oc_product as p join `oc_product_to_category` as pc on pc.product_id=p.product_id JOIN`oc_product_special` as ps on p.product_id=ps.product_id WHERE pc.category_id=415
3> Now its time to update prices of all Products once by updating price and special price
UPDATE
oc_product as p join `oc_product_to_category` as pc
on pc.product_id=p.product_id
JOIN `oc_product_special` as ps on p.product_id=ps.product_id
SET ps.price=0
WHERE pc.category_id=656
UPDATE
oc_product as p join `oc_product_to_category` as pc
on pc.product_id=p.product_id
JOIN `oc_product_special` as ps on p.product_id=ps.product_id
SET p.price=499
WHERE pc.category_id=656
Comments
Post a Comment