3

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.
2
  • getting any solution ??? Commented Apr 1, 2020 at 14:03
  • No i can not get any solution
    – hardik
    Commented Apr 17, 2020 at 9:49

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.