How to get all the Products of Cart in Magento


In Magento or any E-Commerce Cart is the important feature. Cart always helps to show items added for buying with its quantity , Item Name and its price.
We can see total amount we need to pay .
Some time shipping is also shown in the cart else in other cases shipping is been seen in the checkout process.
So as a Magento Developer we can get Magento Cart items any where and we can show it with all the details.
For example lets create cms page or block and set it with any phtml file.
Then Paste below code to get all the cart items with Product Name, Price , Quantity etc.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>How to get all the Products of Cart in Magento</title>
<!-- How to get all the Products of Cart in Magento-->
 //Get All the Products of Cart
 $cart = Mage::getModel('checkout/cart')->getQuote();
 $items = $cart->getAllVisibleItems();
 foreach ($items as $itemId => $item) 
	echo 'Pid='.$productId  = $item->getProductId();
	echo '<br>';
	echo 'itemid='.$itemId  = $item->getItemId();
	echo '<br>';
	echo 'qty='.$productQty = $item->getQty();
	echo 'price='.$productQty = $item->getPrice();
	//Load Product Collection to get All the Details of Products
	$product = Mage::getModel('catalog/product')->load($productId);