0

Magento EE 1.11.2.0 doesn't have that check box for auto generating the coupon codes. See the below image.

enter image description here

I doubt whether this functionality has been introduced with later versions from Magento EE 1.14.x

Please any clue will be appreciated.

1 Answer 1

0

After a quick look at the source I think it should have this functionality.

The form in question is defined in Mage_Adminhtml_Block_Promo_Quote_Edit_Tab_Main::_prepareForm

It has a section of code which adds the coupon_type form element like

    $couponTypeFiled = $fieldset->addField('coupon_type', 'select', array(
        'name'       => 'coupon_type',
        'label'      => Mage::helper('salesrule')->__('Coupon'),
        'required'   => true,
        'options'    => Mage::getModel('salesrule/rule')->getCouponTypes(),
    ));

Mage_Salesrule_Model_Rule::getCouponTypes() is defined like

/**
 * Retrieve coupon types
 *
 * @return array
 */
public function getCouponTypes()
{
    if ($this->_couponTypes === null) {
        $this->_couponTypes = array(
            Mage_SalesRule_Model_Rule::COUPON_TYPE_NO_COUPON => Mage::helper('salesrule')->__('No Coupon'),
            Mage_SalesRule_Model_Rule::COUPON_TYPE_SPECIFIC  => Mage::helper('salesrule')->__('Specific Coupon'),
        );
        $transport = new Varien_Object(array(
                'coupon_types' => $this->_couponTypes,
                'is_coupon_type_auto_visible' => false
        ));
        Mage::dispatchEvent('salesrule_rule_get_coupon_types', array('transport' => $transport));
        $this->_couponTypes = $transport->getCouponTypes();
        if ($transport->getIsCouponTypeAutoVisible()) {
            $this->_couponTypes[Mage_SalesRule_Model_Rule::COUPON_TYPE_AUTO] = Mage::helper('salesrule')->__('Auto');
        }
    }
    return $this->_couponTypes;
}

You can see that the auto coupon type is toggled and controlled by an observer salesrule_rule_get_coupon_types.

The only vanilla observer for this that I can see is the Enterprise_Reminder_Model_Observer::getCouponTypes method which is defined like

public function getCouponTypes($observer)
{
    if ($transport = $observer->getEvent()->getTransport()) {
        $transport->setIsCouponTypeAutoVisible(true);
    }
    return $this;
}

If you're not seeing this auto option appearing, I would make sure the Enterprise_Reminder module is enabled in app/etc/modules/Enterprise_Reminder.xml

If it still isn't appearing, make sure no other observer is defined with an xml path like

    <events>
        <salesrule_rule_get_coupon_types>
            <observers>
                <enterprise_reminder>

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.