Search code examples
catalogmagento-1.5promotionsmagento

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


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.


Solution

  • 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();