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
Looking at your code downloaded from http://goo.gl/O7dBy you define:
dispatcher/observer
hookToAddToCartAfter
and define the model alias of dispatcher
as:
MyPackage_Crossdata_Dispatcher_Model
The resulting class name would be MyPackage_Crossdata_Model_Dispatcher_Model_Observer
, but your observer class is named MyPackage_Crossdata_Dispatcher_Model_Observer
, missing the Model
in between Crossdata
and Dispatcher
.
I'd recommend to drop the whole dispatcher
models definition above and only use the other model alias crossdata
which you've already defined in config.xml
:
MyPackage_Crossdata_Model
crossdata_mysql4
Then change the event definition to:
crossdata/observer
hookToAddToCartAfter
Create a file /app/code/local/MyPackage/Crossdata/Model/Observer.php
and define your observer class in it:
class MyPackage_Crossdata_Model_Observer
{
public function hookToAddToCartAfter($observer)
{
// your observer code
}
}