I am running an observer on Magento 1.9 on the following event:
sales_quote_merge_after
This event occurs when a guest customer with items in their cart logs into their account. When doing this the quote item IDs are dropped from the current session and the products are re-added with new IDs. What I need to know (using an observer or otherwise), is what each quote item ID was before, and what it has changed into.
I have tried countless observers on the Mage_Sale_Model_Quote::addItem method, but Magento does not return the new quote item ID on any method I have seen.
In the observer above I have managed to make it pass the original quote and new quote into the observer, but there's no way of matching the quote item IDs.
I have tried adding the original quote item ID as an option to the quote item which works, but as soon as the merge is carried out the options are wiped!
$item->addOption(array(
'code' => 'original_quote_item_id',
'product' => $item->getProduct()->getId(),
'value' => $item->getId()
));
I'm left perplexed on where to try next - any advice or suggestions would be greatly appreciated!