I am fetching cart item on following .phtml file
frontend/base/default/template/checkout/cart/shipping.phtml
by using the below code
$cart = Mage::getModel('checkout/cart')->getQuote();
echo "<pre>";print_r($cart->getData());echo "</pre>";
I get an array of cart item but when I use the below code
foreach ($cart->getAllItems() as $item) {
echo "<pre>";print_r($item->getData());echo "</pre>";
}
then on the frontend the page keeps loading for some time and then returns nothing.
I'm not getting anything just an empty white screen.
Nothing loads on the page. But when I use this
foreach ($cart->getAllItems() as $item) {
echo $item->getProductId();
}
then I get the ids of the products in the cart. Could anyone tell me the reason why it is happening, why getData() is not working but I am able to use getProductId() or getProductName().