1

I have a website and I am using Magento 1.7.2 cart. I am also utilizing the Advanced Search. My problem is when you select "All" from Power Watts under advanced search then click search the product display page show up all messed up.

Here is my return page return.phtml code:

?>
<div class="page-title">
    <h1><?php echo $this->__('Catalog Advanced Search') ?></h1>
</div>
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
<?php if($this->getResultCount()): ?>
    <p class="advanced-search-amount">
        <?php echo $this->helper('catalogsearch')->__('<strong>%d item(s)</strong> were     found using the following search criteria', $this->getResultCount()); ?>
    </p>
<?php else: ?>
    <p class="error-msg"><?php echo $this->helper('catalogsearch')->__('No items were     found using the following search criteria.');?> <a href="<?php echo $this->getFormUrl(); ?    >"><?php echo $this->helper('catalogsearch')->__('Modify your search'); ?></a></p>
<?php endif; ?>

<div class="advanced-search-summary">
    <?php $searchCriterias=$this->getSearchCriterias(); ?>
        <?php foreach (array('left', 'right') as $side): ?>
            <?php if(@$searchCriterias[$side]): ?>
                <ul>
                    <?php foreach($searchCriterias[$side] as $criteria): ?>
                        <li><strong><?php echo $this->htmlEscape($this->helper('catalog')->__($criteria['name'])); ?>:</strong> <?php echo $this->htmlEscape($criteria['value']); ?></li>
                    <?php endforeach; ?>
                </ul>
            <?php endif; ?>
        <?php endforeach; ?>
        <?php if($this->getResultCount()): ?>
        <p>
            <?php echo $this->helper('catalogsearch')->__("Don't see what you're lookingfor?"); ?>
        <a href="<?php echo $this->getFormUrl(); ?>"><?php echo $this->helper('catalogsearch')->__('Modify your search'); ?></a>
        </p>
    <?php endif; ?>
</div>
<?php if($this->getResultCount()): ?>
<?php echo $this->getProductListHtml() ?>
<?php endif; ?>
<?php $this->getSearchCriterias(); ?>

Here is my catalog.xml file:

<?xml version="1.0"?>
<layout version="0.1.0">

    <default>
        <reference name="header">
            <block type="core/template" name="top.search" as="topSearch" template="catalogsearch/form.mini.phtml"/>
        </reference>
        <reference name="footer_links">
            <action method="addLink" translate="label title" module="catalogsearch" ifconfig="catalog/seo/search_terms">
                <label>Search Terms</label>
                <url helper="catalogsearch/getSearchTermUrl" />
                <title>Search Terms</title>
            </action>
            <action method="addLink" translate="label title" module="catalogsearch">
                <label>Advanced Search</label>
                <url helper="catalogsearch/getAdvancedSearchUrl" />
                <title>Advanced Search</title>
            </action>
        </reference>
    </default>

    <catalogsearch_result_index translate="label">
        <label>Quick Search Form</label>
        <reference name="root">
            <action method="setTemplate"><template>page/3columns.phtml</template></action>
        </reference>
        <reference name="left">
            <block type="catalogsearch/layer" name="catalogsearch.leftnav" after="currency" template="catalog/layer/view.phtml"/>
        </reference>
        <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">
                    <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_result_index>

    <catalogsearch_advanced_index translate="label">
        <label>Advanced Search Form</label>
        <!-- Mage_Catalogsearch -->
        <reference name="root">
            <action method="setTemplate"><template>page/2columns-right.phtml</template></action>
        </reference>
        <reference name="head">
            <action method="setTitle" translate="title" module="catalogsearch"><title>Advanced Search</title></action>
            <action method="addItem"><type>js_css</type><name>calendar/calendar-win2k-1.css</name><params/><!--<if/><condition>can_load_calendar_js</condition>--></action>
            <action method="addItem"><type>js</type><name>calendar/calendar.js</name><!--<params/><if/><condition>can_load_calendar_js</condition>--></action>
            <action method="addItem"><type>js</type><name>calendar/calendar-setup.js</name><!--<params/><if/><condition>can_load_calendar_js</condition>--></action>
        </reference>
        <reference name="content">
            <block type="catalogsearch/advanced_form" name="catalogsearch_advanced_form" template="catalogsearch/advanced/form.phtml"/>
            <block type="core/html_calendar" name="html_calendar" as="html_calendar" template="page/js/calendar.phtml"/>
        </reference>
    </catalogsearch_advanced_index>

<!--
Advanced search results
-->

    <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>

    <catalogsearch_term_popular translate="label">
        <label>Popular Search Terms</label>
        <remove name="right"/>
        <remove name="left"/>

        <reference name="head">
            <action method="setTitle" translate="title" module="catalogsearch"><title>Search Terms</title></action>
        </reference>
        <reference name="root">
            <action method="setTemplate"><template>page/1column.phtml</template></action>
        </reference>
        <reference name="content">
            <block type="catalogsearch/term" name="seo.searchterm" template="catalogsearch/term.phtml"/>
        </reference>
    </catalogsearch_term_popular>

</layout>

Why is this doing this and how can get this page back to default? The layout for some reason cuts off and I need to be like the products pages.

Here is the link to the products page see how this lays out fine: http://www.webstertoolbox.com/index.php/products/genlume-collection.html

You can find the site here: http://www.webstertoolbox.com/index.php/catalogsearch/advanced/result/?name=&sku=&power_wattage%5B%5D=57

Let me know if you need anything else?

  • 1
    Both pages look the same to me – Marius Aug 8 '13 at 9:20
  • @Marius Thank you for the extra help! Do you have any reason why this is doing this? – Frank G. Aug 8 '13 at 9:21
  • Doing what? I don see any difference in the layout of the page. What is messed up? Can you post an image? – Marius Aug 8 '13 at 9:36
  • @Marius here is an image to see what the problem is webstertoolbox.com/magento.jpg Thanks again! Any suggestions? – Frank G. Aug 8 '13 at 18:14
3

The problem is with your grid columns. They are 4 and should be 3.
Open the file app/design/frontend/{interface}/{theme}/layout/catalogsearch.xml, look for the tag catalogsearch_result_index.
Inside it there should be this line:

<action method="addColumnCountLayoutDepend"><layout>two_columns_right</layout><count>4</count></action>

Change 4 into 3, clear the cache and try again.

| improve this answer | |
  • that worked for advanced search but I seem to have the same problem with the search bar at the top of the site. If you type XLD and click search it shows the same thing. Now I went through the catalog search and I changed <action method="addColumnCountLayoutDepend"><layout>two_columns_right</layout><count>2</count></action> to 2 products and cleared cache and that didn't fix that. Here is an example: webstertoolbox.com/index.php/catalogsearch/result/?q=XLD Any other suggestions for this? Thanks again for your help!! – Frank G. Aug 8 '13 at 19:08
  • @FrankG. change this <action method="addColumnCountLayoutDepend"><layout>three_columns</layout><count>3</count></action> to this <action method="addColumnCountLayoutDepend"><layout>three_columns</layout><count>2</count></action> – Marius Aug 8 '13 at 19:14
2

Marius is partially correct, but you'll want to change it in your local.xml: app/design/frontend/{theme}/{variant}/layout/local.xml

In there add:

<catalogsearch_advanced_index>
    <reference name="search_result_list">
        <action method="setColumnCount">
            <count>3</count>
        </action>
    </reference>
</catalogsearch_advanced_index>

for the quick search (searching from the search bar):

<catalogsearch_result_index>
    <reference name="search_result_list">
        <action method="setColumnCount">
            <count>3</count>
        </action>
    </reference>
</catalogsearch_result_index>
| improve this answer | |
  • I looked both in my Base and Default and can't find the local.xml file any were. Am I missing something please help thanks? – Frank G. Aug 8 '13 at 20:42
  • 1
    You never want to edit core files in Magento. Foruntately there are a lot of ways to change virtually everything about Magneto without changing the core files. If you go into Magento Admin, go to System > Config. Then under the General > Design tab, you can change package and theme settings. If you set the Package Name to MyCompany and set Layout to MyTheme, then you will want to create a file called local.xml in the directory app/design/frontend/MyCompany/MyTheme/layout/ and put the code above into that file. – andyjv Aug 9 '13 at 0:16
  • I have a theme already but for some reason magento still refers to its based xml files for somethings. Does Magento go to the theme folder to see if a file for example catalogsearch.xml (which magento is using from base because my theme doesn't have it) is there and if it doesn't find it then it goes to the base folder to get it there? If that's the case can I copy those files over. I don't like modifying things outside the them because if I need to move the site i'll wind up missing them. Or upgrading as well. – Frank G. Aug 9 '13 at 0:57
  • 1
    local.xml takes highest priority over all other layout files. I don't believe simply copying and pasting layout files into the theme folder works; either way, local.xml will. If it doesn't then there is something wrong in local.xml. The only thing you can directly copy-paste into a theme folder to edit are template files. It will search your theme directory for .phtml files before using Mage files, but the folder structure for the copied file has to be the same. – andyjv Aug 9 '13 at 1:00
  • Well in the admin panel I have my theme selected for everything under Design. So if I were to go to the base folder and pull the catalogsearch.xml to my theme's layout do you think magento would start using that instead of the base one and is there a way to test if it is? Thanks again! – Frank G. Aug 9 '13 at 1:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.