I want to save some custom data to quote and order item, when a product is added to cart. I have a custom controller with an addtocartAction where i do the following:
...
$cart->addProduct($product, array(
'qty' => $params['qty'] ? $params['qty'] : 1
));
...
The action is called via ajax with some data i have to save to the quote item. Where can i do that? Adding the custom attribute to the quote item is not the problem, but changing the value of the attribute. The Product can be more than one time in cart, but with different attribute values in the quote item.
Best Answer
Instead of using a custom controller it's easier (and perhaps cleaner) to do this from a controller. So, we'll need to build a little module for that
config.xml
your setup script
And the observer
[Namespace]/[Module]/Model/Observer.php