I am trying to create an event dispatcher in Magento (which should be called after a product gets added to cart).
What I’ve done so far:
I Googled this and found this link. I followed the instructions specified in this link. I configured the config.xml file and created a Observer.php filder under mymodule/model folder. But, I can’t see any result from this.
(The code for config.xml and Observer.php file that i used in my example can be found under http://goo.gl/O7dBy, my custom module name is Crossdata and package name is MyModule – am i doing it wrong?)
Any other link with simple helloworld event dispatcher example would be helpful.
Thanks,
Balan
Looking at your code downloaded from http://goo.gl/O7dBy you define:
and define the model alias of
dispatcheras:The resulting class name would be
MyPackage_Crossdata_Model_Dispatcher_Model_Observer, but your observer class is namedMyPackage_Crossdata_Dispatcher_Model_Observer, missing theModelin betweenCrossdataandDispatcher.I’d recommend to drop the whole
dispatchermodels definition above and only use the other model aliascrossdatawhich you’ve already defined inconfig.xml:Then change the event definition to:
Create a file
/app/code/local/MyPackage/Crossdata/Model/Observer.phpand define your observer class in it: