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="http://192.168.0.2/~charlesgrisar/magento/media/catalog/product/cache/1/stylepict//a/g/agrumes_3_1.jpg" width="30" height="20" title="White, fresh and fruity" />
In the second it is:
<img src="http://192.168.0.2/~charlesgrisar/magento/media/catalog/product/cache/1/stylepict/" 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)