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 magento.stackexchange.com, 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 community@magento.com.

Magento Forum

How show specific attribute in search result and home page
 
Aldo
Member
 
Total Posts:  47
Joined:  2008-02-18
 

Hello

I’m trying to show a specific attribute in the search result and home page.
I managed it for the catalog page adding the following in the <catalog_category_default> section of catalog.xml

<action method="addAttribute"><code>language</code></action>

<catalog_category_default>

        <
reference name="content">
            <
block type="catalog/category_view" name="category.products" template="catalog/category/view.phtml">
                <
block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml">
                    <
action method="addAttribute"><code>language</code></action>
                    <
block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
                    </
block>
                    <
action method="setToolbarBlockName"><name>product_list_toolbar</name></action>
                </
block>
            </
block>
        </
reference>
    </
catalog_category_default>

Where should I add this code snippet to enable this attribute in the search reslut and home page?

Thanks for any help.
Aldo

 
Magento Community Magento Community
Magento Community
Magento Community
 
Aldo
Member
 
Total Posts:  47
Joined:  2008-02-18
 

Anybody an idea on this?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Albert van der Veen
Jr. Member
 
Total Posts:  15
Joined:  2008-05-30
Amsterdam
 

Same question here. If I add it to the section <catalogsearch_result_index> in catalosearch.xml like this, it generates an error:

<reference name="content">
<block type="catalogsearch/result" name="search.result" template="catalogsearch/result.phtml">
<block type="catalog/product_list" name="search_result_list" template="catalog/product/list.phtml">
<action method="addAttribute"><attribute>publisher</attribute></action>
</block>
<action method="setListOrders"/>
<action method="setListModes"/>
<action method="setListCollection"/>
</block>
</reference>

The error:

Call to a member function getProductCollection() on a non-object in \app\code\core\Mage\Catalog\Model\Layer.php on line 41

 
Magento Community Magento Community
Magento Community
Magento Community
 
Albert van der Veen
Jr. Member
 
Total Posts:  15
Joined:  2008-05-30
Amsterdam
 

Solution for adding custom attribs to search results can be found here (tested):

http://www.magentocommerce.com/boards/viewthread/1610/P45/#t51717

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