I'm trying to show additional attributes for products that are showing up in the "Related Products" section of an individual product listing. I have some items that have Artist/Author attributes and if they do I would like to show them.

Here is part of my code in: template/catalog/product/list/related.phtml

<?php foreach($this->getItems() as $_item): ?>
    <div class="product panel" data-equalizer-watch>
      <a href="<?php echo $_item->getProductUrl() ?>" title="<?php echo $this->escapeHtml($_item->getName()) ?>" class="product-image"><img src="<?php echo $this->helper('catalog/image')->init($_item, 'thumbnail')->resize(280) ?>" alt="<?php echo $this->escapeHtml($_item->getName()) ?>" /></a>
      <div class="product-details">
        <h6 class="product-name"><a href="<?php echo $_item->getProductUrl() ?>"><?php echo $this->escapeHtml($_item->getName()) ?></a></h6>

        <?php if ($_item->getAuthorArtist()): ?>
          <span class="author">By: <?php echo $_item->getAuthorArtist() ?></span>
        <?php endif; ?>

<?php endforeach ?>

For some reason the author/artist never show up. I can verify that the author/artist is correctly configured because I'm using very similar syntax (changing $_item) on the main product page and it's working fine.

I found this question: show attributes in description.phtml but when I tried editing it like this <?php echo $_product->getAttributeText('AuthorArtist'); ?> it makes Magento blow up.

Somehow I'm must not be targeting the item object correctly...

1 Answer 1


I always like using $_item->getData("attribute_code"). It's just cleaner and I quickly know when I am accessing an attribute or when I'm calling a procedure.

Go to your Magento Admin, and visit the page Catalog->Attributes->Manage Attributes. Choose the attribute you have setup for Artist/Author. Note the "attribute code" and use it in the getData call I show above. Also, while you are here, make sure Used in Product Listing is set to true.

  • getData for the win
    – Bobadevv
    Nov 18, 2015 at 20:11
  • I knew that I had to enable the attribute in the Magento Admin... but somehow I missed that! Thanks for the help! Thanks for the info about getData , that's good to know.
    – NateW
    Nov 18, 2015 at 21:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.