Please see attached. How do I add the product attribute selected when product was created to the shopping cart page? Thanks for your attention.
In cart.phtml of your current theme create new column and place “Product Type”.
In my case page was located:
Add new column on default.phtml of your current them.
My case it was located in
Use the following code to print the attribute value
<?php $productId = $_item->getId(); $productInfo = Mage::getModel("catalog/product")->load($productId); echo $productInfo->getAttributeText('product_type'); ?>
I am new to magento. Can you please give me a step by step as to how I “create the new column” and make it functional. I went into my cart.phtml and duplicated one of the lines please see attached.
Where in the default.phtml do I add the code you provided? I tried different placements and ALL disabled the shopping cart page.
I placed the following code in the default.phtml at line number 69
<td> <?php $productId = $_item->getId(); $productInfo = Mage::getModel("catalog/product")->load($productId); echo $productInfo->getAttributeText('product_type'); //Attribute Code ?> </td>
Remember by attribute code was “product_type”. Change this accordingly to your store.
How do I add the “Product Type” column to the page?
What do I add to cart.phml? and what line do I add it?
What you have given me is NOT working.
I am attaching default.php located in “app/design/frontend/base/default/template/checkout/cart/item/”
Thanks, can you send me the cart.phtml too.
Not working. I first I made the changes in your file in mine. Then I just copied your file over mine. Both did not work. I even tried 8 different attribute codes just to be sure the attribute code is not the issue.
in your cart.phtml page
<th rowspan="<?php echo $mergedCells; ?>"><span class="nobr"><?php echo $this->__('Your New Column') ?></span></th>
in your default.phtml
<td> <?php $productId = $_item->getId(); $productInfo = Mage::getModel("catalog/product")->load($productId); echo $productInfo->getResource()->getAttribute('attribute_code')->getFrontend()->getValue($productInfo); ?></td>
Hopefully-->this will help!!!!!
Excellent advice and code Magento4u. Thanks
We'd like to hear from you! Call us, send us an email or talk to sales.
See Magento in the news, find press releases and resources for media.
Thank you for subscribingPlease check your email for a confirmation.