9

I'm very confused with a small issue in my catalog/product/list.phtml file.

i'm trying to add the Manufacturer attribute that comes with Magento to my grid listing and have added the following code.

<?php echo $_product->getAttributeText('manufacturer') ?>
<?php if( $_product->getAttributeText('manufacturer') ): ?>
 <p class="manufacturer">Manufactured by:<br/><?php echo $_product->getAttributeText('manufacturer')?></p>
<?php endif; ?>

Now this is the same code I've used on my product/view.phtml page and it works there. But this doesn't work at all, the echo by its self or using it in the if statement. Both return nothing.

So I have to do something special to get these attributes on the list.phtml file?

asked Oct 24, 2013 at 11:35

1 Answer 1

15

Make sure the attribute manufacturer (and others that you want to list) have the flag Use in product listing set to Yes. After setting the flag you should rebuild your product flat index if Flat catalog is enabled.

answered Oct 24, 2013 at 11:38
1
  • Damn, right yes that makes sense. I did not include it because it's being called somewhere custom no the view.phtml template. I'll have to override the product listing row in view.phtml to exclude it manually the. Thanks. Commented Oct 24, 2013 at 11:55

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.