1

I'd like to add a filter in categories lists to display only products on sales. For now I use a filtered attribute like "marketing" and I add manually all products in sales define by a Catalog Rule.

Is there a way to programmatically check with a cron if a rule exist and add the "sales" value for the "marketing" attribute to products that match this rule?

Or maybe add a custom filter?

1 Answer 1

5

Ofcourse you can create a cron job which allows you to match the products in catalog price rules table i.e. catalogrule_product using the following select statement

select distinct product_id from catalogrule_product

For the above selected products you can set 'marketing' attribute to whatever value you want to show.

The above way solves the problem you want to solve but it is not an elegant way to show your customers sale products because they need to browse through each and every category to find sale products. I would rather create a sale or offer category and show sale products in one place.

There are several extensions which allows you to do that but for our site we have used the following extensions

https://www.scommerce-mage.com/magento2-dynamic-sale-category.html

Hope it helps. Thanks

3
  • Thanks for your answer, I will check this module maybe its more easy to use. Do you know if its works with configurable product (The demo they provide is only with simple product : no size or color)
    – cap340
    Jan 27, 2018 at 20:20
  • @urbansurfers - Not sure we have simple products on our website but you can check with the developers. I would be really surprised if it doesn't work with the configurable products.
    – user58113
    Jan 28, 2018 at 19:10
  • I ask them before buying and they say YES! this is exactly what I was looking for, I strongly recommend this module. Thanks again for your help
    – cap340
    Jan 29, 2018 at 22:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.