1

I would like to create a promocode for customer successful registration. so i have used customer_register_success to observe the registration success event.

app/code/local/Promocustomer/Promogeneration/etc/config.xml,

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <modules>
        <Promocustomer_Promogeneration>
            <version>0.0.1</version>
        </Promocustomer_Promogeneration>
    </modules>
    <global>
        <models>
            <Promocustomer_Promogeneration>
                <class>Promocustomer_Promogeneration_Model</class>
            </Promocustomer_Promogeneration>
        </models>
        <events>
            <customer_register_success>
                <observers>
                    <Promocustomer_promogeneration_model_observer>
                        <type>singleton</type>
                        <class>Promocustomer_Promogeneration_Model_Observer</class>
                        <method>promocode</method>
                    </Promocustomer_promogeneration_model_observer>
                </observers>
            </customer_register_success>
        </events>
    </global>
</config>

app/code/local/Promocustomer/Promogeneration/Model/Observer.php,

<?php 
/**
* Auto  Promo Code Generator 
*/
class Promocustomer_Promogeneration_Model_Observer {

    public function promocode($observer){
        $event = $observer->getEvent();
        $customer = $event->getCustomer();
        $email = $customer->getEmail();
        if($email){
            $message= "Successfully Registered";
        }else{
            $message= "Error In Register";
        }
        echo $message;
        exit();
        //Mage::log(var_export($message,TRUE),null,'promo.log');
    }
}
?>

My question is, why the event is not working? and when the event will trigger? Can someone give me the solution for this questions.

Thanks!

4
  • do you have activation file of your module defined ? Commented Sep 19, 2015 at 8:04
  • yes i have @RajeevKTomy
    – Gayathri
    Commented Sep 19, 2015 at 8:06
  • actually the error is in the customer registration process, i have corrected it... so its working fine now.. Thanks for the help
    – Gayathri
    Commented Sep 19, 2015 at 8:08
  • if your issue resolved, please put it as an answer and accept it. Commented Sep 19, 2015 at 8:09

1 Answer 1

2

For Me, the problem was in app/etc/modules/MyModuleNameSpace_ModuleName.xml

<codepool>local</codepool>

should be changed to

<codePool>local</codePool>

capitalize the P and all is well!

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.