2

I created an observer to update subscribers on mailchimp without using any mailchimp extension,

Below is my module which i tried.

app\etc\modules\HTD_Subscribers.xml

<?xml version="1.0"?>
<config>
<modules>
<HTD_Subscribers>
  <active>true</active>
  <codePool>local</codePool>
  <version>0.1.0</version>
</HTD_Subscribers>
</modules>
</config>

code\local\htd\Sms\subscribers\config.xml

<?xml version="1.0"?>
<config>
<modules>
    <HTD_Subscribers>
        <version>0.1.0</version>
    </HTD_Subscribers>
</modules>
<global>
    <models>
        <subscribers>
            <class>HTD_Subscribers_Model</class>
        </subscribers>
    </models>
    <events>
        <customer_register_success>
            <observers>
                <customer_register_successhtd_subscribers>
                    <class>htd_subscribers/observer</class>
                    <method>SubscribeCustomer</method>
                </customer_register_successhtd_subscribers>
            </observers>
        </customer_register_success>
    </events>
 </global>
</config>

code\local\HTD\Subscribers\Model\Observer.php

<?php
class HTD_Subscribers_Model_Observer extends Varien_Event_Observer
{
public function SubscribeCustomer($observer){

echo "here ";exit();
    //My code goes here
}
}

My observer is not called after customer successfully registered to the website. Magento version is 1.9. Is there any version conflicts for events? Hope some one can find my mistake and help me on this.

1 Answer 1

3

There is a simple issue at config.xml observer class.

You have call model prefix as subscribers( <subscribers>) but at observer is class model prefix htd_subscribers.But as per magento , it should be subscribers

<class>htd_subscribers/observer</class>

should be

<class>subscribers/observer</class>
1
  • Thank you Amith, Can you please explain some more "as per magento" for future references also.It will help to understand the magento rules.
    – Mujahidh
    Jun 4, 2015 at 5:53

Your Answer

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

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