Jump to content

Automatically assign a category to a product on sale


piR-web

Recommended Posts

Hello,

I call you because I have a problem I have created fields in the table products to be able to insert promotions without having to use the specific price.

I would like to automatically assign a category to a product so the promo price is filled in and the current date is included between date_debut_promo and date_fin_promo.


I have this code in product.tpl:
{If (isset ($ product-> prix_promo) && $ product-> date_debut_promo <= $ now && $ now <= $ product-> date_fin_promo)}

{$ Product-> addToCategories ([113])}

{Else}
{$ Product-> deleteCategories ([113])}

But I am obliged to return to my product page for the category to be inserted or removed.
Now I would like this change to be done automatically as my fields are changed to database.

Do you have a solution to my problem?

I remain at your disposal,

Regards,

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...