Search code examples
magentocoupon

Magento get coupon description


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?


Solution

  • Under Magento 1.3, you can use this code (not tested as I have no 1.3 within easy reach) :

    $rule = Mage::getModel('salesrule/rule')->load($code, 'coupon_code');
    
    if ($rule->getId()) {
        $description = $rule->getDescription();
    }