Question

Generating coupon code when a subscriber subscribes to the newsletter it's working fine before applying SUPEE-11155 but after applied SUPEE-11155 not working.

Magento version 1.9.4.0

$model = Mage::getModel('salesrule/rule');
$model->load(301);
$massGenerator = $model->getCouponMassGenerator();
$session = Mage::getSingleton('core/session');
$ruleId = Mage::getStoreConfig(301);
if (!is_numeric($ruleId)) {
    return self::ERROR_SHOPPING_CARD_RULE_IS_MISSING;
}

$rule = Mage::getModel('salesrule/rule')->load($ruleId);
if (!$rule->getId()) {
    return self::ERROR_SHOPPING_CARD_RULE_IS_MISSING;
}

try {
    $massGenerator->setData(
        array(
            'rule_id' => $ruleId,
            'qty' => 1,
            'length' => Mage::getStoreConfig('newsletter/coupon/length'),
            'format' => Mage::getStoreConfig('newsletter/coupon/format'),
            'prefix' => Mage::getStoreConfig('newsletter/coupon/prefix'),
            'suffix' => Mage::getStoreConfig('newsletter/coupon/suffix'),
            'dash' => Mage::getStoreConfig('newsletter/coupon/dash'),
            'uses_per_coupon' => 1,
            'uses_per_customer' => 1
        )
    );
    $massGenerator->generatePool();
    $latestCuopon = max($model->getCoupons());
} catch (Mage_Core_Exception $e) {
    $session->addException($e, $this->__('There was a problem with coupon: %s', $e->getMessage()));
} catch (Exception $e) {
    $session->addException($e, $this->__('There was a problem with coupon.'));
}

Below is exception.log

[0] => There was a problem with coupon: %s
[1] => Disallowed template variable method.

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top