Difference between two commands of fetching Shopping Cart Items in Magento

Posted by Knowledge Craving on Stack Overflow See other posts from Stack Overflow or by Knowledge Craving
Published on 2010-06-15T06:11:46Z Indexed on 2010/06/15 12:02 UTC
Read the original article Hit count: 274

In Magento, if you need to get / fetch the Shopping Cart's Item details, you can do it in any of the two possible ways, which will provide you with all the shopped Items in an array:-

  1. $cartItems1 = $cart->getQuote()->getAllItems();
  2. $cartItems2 = $cart->getItems()->getData();

But before using any one of the above two methods, you need to initialize the shopping cart object as:-

$cart = new Mage_Checkout_Model_Cart();
$cart->init();

Can anyone please describe in details as to what the two options provide & their differences between each other, along with their possible usage.

In any more such option is available in Magento, can anyone please highlight it?

© Stack Overflow or respective owner

Related posts about php

Related posts about web-development