Reputation: 7778
I want to get the Guest user cart details in magento. Suppose a user comes to Magento site and add a product to cart.Then again come to same product and again he wants to add the product to cart.Now I want to check if the same guest user has already that product in the cart.
I am using following to get the guest user details$session=Mage::getModel('core/session');
using above code If I use print_r(session)
then I get a visitor Id.
How Can I load the check out cart collection using this visitor ID to check If he already have that product in the cart.
Upvotes: 1
Views: 1505
Reputation: 4141
To get the items stored in the cart you can use:
Mage::getSingleton('checkout/session')->getCart()->getItems()
Then you can loop over all the items and check wether the id is already there.
Upvotes: 1