开发者

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

How can I get 开发者_如何学PythonCatalog Price Rule programmatically in the front-end by Rule Name? I need the Discount Amount of a particular price rule.


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


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.


To get the rule name:

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜