I am trying to retrive the text set in the Magento Coupon Description field to use as part of a validation rule. Does anyone know how to load a coupon price rule using the coupon code and retrieve the associated coupon description text?
3 Answers
2
votes
2
votes
I have used in magento 1.9 and below code is working fine for me.
$oCoupon = Mage::getModel('salesrule/coupon')->load($couponCode, 'code');
$oRule = Mage::getModel('salesrule/rule')->load($oCoupon->getRuleId());
$message = $oRule->getData();
$description = $message['description'];
$this->_getSession()->addError(
$this->__($description, Mage::helper('core')->escapeHtml($couponCode))
);
0
votes
$oCoupon = Mage::getModel('salesrule/coupon')->load($couponCode, 'code');
$oRule = Mage::getModel('salesrule/rule')->load($oCoupon->getRuleId());
var_dump($oRule->getData());
you can refer for same Magento - get rule from coupon code