Suppose if you wants to add the short description to the cart page, to help customers a better idea of the product they have added into the cart here in this post I am trying to describe how it would be possibe. It is very easy and you can do it by following the steps given below:
Step 1. Adding Short Description into the View cart page.
The Magento cart page is mainly controlled by the cart.phtml and all the section like as Discount Codes, Estimate Shipping and Tax, Sub Total and the Grand Totals files are included on this page and the product information section is managed by the default.phtml file, you can get this file app/design/frontend/base/default/template/checkout/cart/item/default.html. Or if you are using your custom template then you will get it default.phtml file in your theme folder app/design/frontend/default/your-theme/template/checkout/cart/item/default.html.
Step 2. Open this file into the editor of your choice and search for the code below
<h2 class="product-name"> <?php if ($this->hasProductUrl()):?> <a href="<?php echo $this->getProductUrl() ?>"><?php echo $this->escapeHtml($this->getProductName()) ?></a> <?php else: ?> <?php echo $this->escapeHtml($this->getProductName()) ?> <?php endif; ?> </h2>
Step 3. Now Add the code below the
tag
<?php $ShortDesCart = Mage::getModel('catalog/product')->load($_item->getProductId()); echo $ShortDesCart->getShortDescription(); ?>
Now the final code will look like as :
<h2 class="product-name"> <?php if ($this->hasProductUrl()):?> <a href="<?php echo $this->getProductUrl() ?>"><?php echo $this->escapeHtml($this->getProductName()) ?></a> <?php else: ?> <?php echo $this->escapeHtml($this->getProductName()) ?> <?php endif; ?> </h2> <?php $ShortDesCart = Mage::getModel('catalog/product')->load($_item->getProductId()); echo $ShortDesCart->getShortDescription(); ?>
This will show the Short Description into the cart page below the Product Name just like as the attached screenshot take a look at the results:
If you want to show the other custom attributes values over here in cart page then you can do it by using the code below:
Suppose I have a custom product attributes with the name Screen Resolutions and the attributes code is screen_resolution then we can show this attributes by using the code below:
<?php $custom_attribute_val = Mage::getModel('catalog/product')->load($_item->getProductId()); echo $custom_attribute_val->getScreenResolution(); ?>
Hope it helps, Thanks and enjoy the reading. 🙂