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