-
Categories
-
Tags
add to cart attributes authorize.net awards category list Code code formatting CSS custom attributes debug debugging design featured sites Free Theme great web design articles HTML jQuery jQuery Tabs magento magento development magento product attributes News payment methods php Post_ Premium Wordpress Theme product grid product list programming recognition sessions upsell products Web Design Web Design Resources web development wordpress Wordpress Theme -
archives
Magento Custom Attributes in Cart
2010
Nov 11th
published in
With all the use of custom attributes in Magento lately I finally had a project where I needed to get the attribute information and display this on the product in the cart page. Copy the file:
/app/design/frontend/default/base/template/checkout/cart/item/default.phtml
to your theme (should be /app/design/frontend/default/yourTheme/template/checkout/cart/item/default.phtml ).
Inside this file there is a td tag that renders the product information. While you can get default product data as you would you can not access custom attributes in the same way as the default data – you need to use the getModel method. So for example to get my custom attribute with the value “seat_location” (assigned in the admin panel):
// Get custom attribute in cart <?php echo Mage::getModel('catalog/product')->load($this->getProduct()->getId())->getAttributeText('seat_location'); ?>
Easy.
This entry was posted in Magento, Web Development and tagged custom attributes, magento, magento development, programming, web development. Bookmark the permalink.
comments
0