I want quote item id every time a product added to cart. I have tried many event they return the quote item object but object doesn't contain quote item id as it exists only when cart save to the db. So is there any event which will return the quote item object with quote item id?
I have used following events
checkout_cart_product_add_after
sales_quote_add_item
but it will not return quote_item_id in
public function addItemToSalesModelInfo(Varien_Event_Observer $observer){
$item = $observer->getEvent()->getQuoteItem();
}
Get quote and items count after adding product to cart.
The item id is only available
checkout_cart_product_add_after
if a fitting item already existed in cart. You will actually have to work in two steps. Listen tocheckout_cart_product_add_after
and add a flag to the item.And then listen to
sales_quote_item_save_after
and add the id to the session (or do whatever) if the flag is set.You are using a correct event i.e.
to access quote item id, you need to use,
you can access all quote item info like
$item->getProductId()
etc..To get quote id and quote's item id, you can get using below code.
To get quote's item id