0

I am working on a Magento 1.9 project, where we developed an extension which sends a 10 % discount coupon to any new newsletter subscriber. We installed now a new extension (advanced newsletter), that overrides the default Magento core newsletter functionalities. In our extension we managed to generate a coupon using an observer (as follows) _config.xml

<global>
    ....
    <events>
        ....
       <an_subscriber_subscribe>
            <observers>
                <your_unique_event_name>
                    <class>yourgroupname/observer</class>
                    <method>newsletterSubscriber</method>
                </your_unique_event_name>
            </observers>
        </an_subscriber_subscribe>
    </events>
</global>

_Observer.php

public function newsletterSubscriber($observer)
    {
$subscriber = $observer->getEvent()->getData(‘subscriber’);
$coupon = $this->_acquireCoupon();
$subscriber->setData(‘discountCoupon’, $coupon->getCode());
}

we save the generated coupon into the advancednewsletter/subscriber model instead of the default magento newsletter/subscriber. The problem is that we can’t get the coupon code inside the locale template email we tried to get it by

_locale/en_US/template/email/newsletter_subscriber_first_subscription.html

Your coupon code 10% discount for your subscription is: {{htmlescape var=$subscriber.getDiscountCoupon()}}

How can I retrieve the coupon code in the email template?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.