Home > Magento > Adding Attribute List To Product View

Adding Attribute List To Product View

Posted on: 12th Mar 2010 By: Adam Moss No Comments

In a recent blog entry I explained how to echo product attributes on the product page, by using a simple calling script. That’s fine and well, but what if you want to echo a large amount of attributes in one go – the type of data that normally is shown in the ‘Additional Info’ tab on the product page. With a couple of simple XML edits, that’s very easy to do:

First open app/design/frontend/base/yourtheme/layout/catalog.xml and enter the following code in the catalog/product_view block:

<block type="catalog/product_view_attributes" name="product.info.attributes" as="attributes" template="catalog/product/view/attributes.phtml"/>

Now open your product view page which is app/design/frontend/base/yourtheme/template/catalog/product/view.phtml. Add the following code to the part of the page where you want the table to appear:

<?php echo $this->getChildHtml('attributes') ?>

On the site that I enabled this on, I duplicated the attributes.phtml page and renamed it attributes-view.phtml and simply linked to this from the XML file. This way you keep a backup of the old one in case you still need it. Keep reading the Magento Blog at E-commerce Website Design for more Magento tips and other ecommerce-related news.

Post A Comment

Your comments:
Enclose code snippets within the appropriate tags: [php][/php]   [js][/js]   [xml][/xml]   [css][/css]   [html][/html]
E.g: [php]<?php echo "hello world"; ?>[/php]

Search Blog

Archives

For the record...

Views & opinions in this blog are those of the individual and do not necessarily reflect those of E-commerce Web Design or the Creare Group.