Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email

Magento Forum

Weird situation
Total Posts:  73
Joined:  2008-03-27

I’ve created a new a attribute ‘stylepict’ with the Media type.

Then I added that attribute in the catalogSearch/Block/Result.php file with

in the _getProductCollection() function.

Why not use <action name="addAtribute"> ?
It doesn’t work with me (whatever the attribute type). I’ve tried it hundreds times over, to no avail.

I’ve further managed to display that attribute through the following code in the catalog/product/list.phtml file

<img src="<?php echo $this->helper('catalog/image')->init($_product, 'stylepict') ?>" width="30" height="20" title="<?php echo $_product->getAttributeText('style') ?>" />

And yes, it works when I let the products show up through search. The attribute (image) is displayed


When I try to show the same attribute when I search through catalog, the media attribute doesn’t show up.

To me this is really weird because it’s the exact same code that is used (catalog/product/list.phtml).

When I check the source of the html that displays the pages, I see some divergence.

In the first situation i see:

<img src="" width="30" height="20" title="White, fresh and fruity" />

In the second it is:

<img src="" width="30" height="20" title="" />

Does anyone have any idea why magento is behaving like that?

(BTW: I just noticed that the getAttributeText(’style’) doesn’t work either)


Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top