Magento – Product Attributes of Products in the Cart

The following piece of code can pull any attribute of the products in the shopping basket. This code can be used anywhere on the website.
/* Get all the items in the cart */
$cartItems = Mage::getSingleton(‘checkout/session’)->getQuote()->getAllItems();
/* Iterate through the items */
foreach ($cartItems as $item) {
/* Load the product and get the custom attribute */