Reputation: 1741
I'm completely new on working with Magento and I'm going to create a module in order to validate and in some cases manipulate some cart/order information.
I've started working on this a bit, but I'm not so satisfied with the solution.
This is how I've done it so far:
I've created a new module with a controller which subclasses Mage_Checkout_CartController
and there I've implemented the addAction
-method. So every time a product is added to the cart I search through the user's order history and look for previous orders containing this product. Then I prevent it from being added and trigger an error-message.
It has a lot of shortcomings. For instance, if the customer isn't logged in at the time he can add the product, you can update the cart with too many... etc.
I would be me comfortable if I could hook on events, but I don't know where to start. Haven't found so good guides about this.
So, my questions are:
config.xml
-configuration for event observing to work. I also need to know the names of these events.If you have any other ideas on a better solution for this, you're very welcome to comment.
I appreciate any help. Thanks.
Upvotes: 1
Views: 2001
Reputation: 5277
I think this article should answer on all your questions. See events list at the bottom of this article. Do not forget delete cache after each change made to config.xml and other xml files in your module etc folder.
Upvotes: 1