itsazzad
itsazzad

Reputation: 7277

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.

Upvotes: 1

Views: 11087

Answers (3)

Claudiu Creanga
Claudiu Creanga

Reputation: 8366

To get the rule name:

$load_rule = Mage::getModel('salesrule/rule')->load($order->getAppliedRuleIds());
$rule_name = $load_rule->getName();

Upvotes: 0

feddyups
feddyups

Reputation: 1

Well, if you go by

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

Then you can do

echo $rule->name;
echo $rule->description;

the above will give you the rules' name and description fields.

Upvotes: 0

itsazzad
itsazzad

Reputation: 7277

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

Upvotes: 5

Related Questions