0

I need the collection of all discounted Product . i find 1 table catalogrule_product in which all discounted products entity are available . How can get these all discounted Products programmatically ?

  • catalogrule_product keeps only those products, for which the discount has been given using catalog price rules. It does not contain the products, for which manually special price has been entered. – Mohit Kumar Arora May 2 at 9:50
  • ahan ! then what is the best solution ? i need to call all discounted product and then set in a block – HaFiz Umer May 2 at 9:54
  • @HaFizUmer check here Ref: magento.stackexchange.com/a/267663/68695 – Rakesh Donga May 2 at 10:10
  • OKay let me check – HaFiz Umer May 2 at 10:13
  • Which Magento version you are looking for? – Dhiren Vasoya May 2 at 10:25
0

There is no predefined logic to get all the discounted products since Magento applies the discount based on various criteria:

  • If the special price is set for the product
  • If the price has been set up based on a particular customer group
  • catalog price rule

I assume that you need to show the discounted products in the frontend. In this case, you need to write code for getting the products for each criterion individually, and then merge the collections and remove the duplicate products from the collection with keeping only the lowest price entry.

Since it is a long process, I can not provide full code, but I hope, the above description would help you.

For the first case (If the special price is set for the product), Magento 2 get special price product collection can help.

  • Yes Sir @Rakesh give me same link – HaFiz Umer May 2 at 10:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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