I have not tried this, but I believe it's possible. I don't have the exact code, but I can provide you with it later when I have more free time if you really need it. This appraoch is pretty straightforward.
There's a table called catalogrule_product
that stores Catalog Price Rules
discounts per product and customer group. Note that this table needs to get indexed every time you make changes to your Catalog Price Rules
. You can do this with the indexer or by clicking "Apply Rules" on this page (this could take long if you have a lot of products).
For a given product you have on a catalog (or any) page, get its entity_id
and look it up on catalogrule_product.product_id
. Make sure to check customer_group_id
as well. Once you find the row(s) you're looking for, this row(s) will have have timestamps (in seconds) from_time
and to_time
for that given applied rule (rule_id
).
Get its row_id
and look this up on catalogrule
if you need more information on the rule. The entry you find on catalogrule
has from_date
and to_date
, and those are all you need to calculate what you want.