magento get Catalog Price Rule or Discount Amount programmatically in the front-end by Rule Name

itsazzad picture itsazzad · Aug 18, 2011 · Viewed 10.6k times · Source

How can I get Catalog Price Rule programmatically in the front-end by Rule Name? I need the Discount Amount of a particular price rule.

Answer

itsazzad picture itsazzad · Aug 19, 2011

I have found a way to make it but not by name and by id:

$rule = Mage::getModel('catalogrule/rule')->load(1); 
$rule->setWebsiteIds("1"); 
echo $rule->getDiscountAmount();

and for price rule for shopping cart use

$rule = Mage::getModel('salesrule/rule')->load(1); 
$rule->setWebsiteIds("1"); 
echo $rule->getDiscountAmount();