Thursday, October 14, 2010

PrestaShop Tips - How to set discount for all prodcuts or products in a specific category in a batch way

At PrestaShop, you can set discount by percentage of by amount, or both. But as I know, you can only set this discount for products one by one. If you want to set discount for all products, or all products in a specific category, it will be very time consuming. But if you have access to database, you can use SQL statement to do it in seconds.

Here I introduce some of SQL to set discount for products in a batch way.

1. Set discount for all products.


Update `ps_product` set `reduction_percent`=YourPercentageDiscount,`on_sale`=1;

Please replace YourPercentageDiscount with your discount. For example 25 for 25 percantage.

2. Set discount for all products in a specific category


Update `ps_product` set `reduction_percent`=YourPercentageDiscount ,`on_sale`=1
where id_product in
(
select distinct id_product
from ps_category_product
where id_category=YourCategpryID
);


Please replace YourPercentageDiscount with your discount. For example 25 for 25 percantage.
Please replace YourPercentageDiscount with id_category. You can find id_category at you Back office.

If you want to set discount for all featured product, just replace YouCategpryID ID of id_category of Home which is 1 by default.

How to find id_category of your product categories
Catalog tab


How to find the id_category of Home(featured products)
Catalog Tab - Go any product detail

1 comment:

Lluxuries said...

I know this thread is really old but...I have access to my database through my c-panel, is there a tool in there where I can add these statements? Or do I need to install mysql on my pc? any help appreciated :)

thanks,
Lisa