1
votes

My problem is, that the advanced search in magento returns no results (the normal search does). If I dump

$this->getLoadedProductCollection()

in my Template, it returns "null". So I looked at the class which sets the collection to the advanced search template/view in "app/code/local/Mage/CatalogSearch/Block/Advanced/Result.php" and found this method:

public function setListCollection() {
    $this->getChild('search_result_list')->setCollection($this->_getProductCollection());
}

If I dump

$this->_getProductCollection();

I get all products matching my search query. But why returns my first method null? I have no idea.

Thanks for your help.

1

1 Answers

1
votes

If the products are there maybe you are not showing the block search_result_list.
Check your layout file catalogsearch.xml and see how the handle <catalogsearch_advanced_result> looks like. It should have a block inside it with the name search_result_list. Compare it to the one in the default theme. To make it easier, here it show it should look like:

<catalogsearch_advanced_result translate="label">
    <label>Advanced Search Result</label>
    <update handle="page_two_columns_right" />
    <!-- Mage_Catalogsearch -->
    <reference name="root">
        <action method="setTemplate"><template>page/2columns-right.phtml</template></action>
    </reference>
    <reference name="content">
        <block type="catalogsearch/advanced_result" name="catalogsearch_advanced_result" template="catalogsearch/advanced/result.phtml">
            <block type="catalog/product_list" name="search_result_list" template="catalog/product/list.phtml">
                <block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
                    <block type="page/html_pager" name="product_list_toolbar_pager"/>
                </block>
                <action method="addColumnCountLayoutDepend"><layout>empty</layout><count>6</count></action>
                <action method="addColumnCountLayoutDepend"><layout>one_column</layout><count>5</count></action>
                <action method="addColumnCountLayoutDepend"><layout>two_columns_left</layout><count>4</count></action>
                <action method="addColumnCountLayoutDepend"><layout>two_columns_right</layout><count>4</count></action>
                <action method="addColumnCountLayoutDepend"><layout>three_columns</layout><count>3</count></action>
                <action method="setToolbarBlockName"><name>product_list_toolbar</name></action>
            </block>
            <action method="setListOrders"/>
            <action method="setListModes"/>
            <action method="setListCollection"/>
        </block>
    </reference>
</catalogsearch_advanced_result>