0

我正在尝试将高级搜索结果页面 (www.website.com/catalogsearch/advanced/result/) 的布局从 2columns-right 更改为 2columns-left。

我已尝试更改 app/design/frontend/default/theme261/layout/catalogsearch.xml,因此对 2columns-right.phtml 的所有引用现在都是 2columns-left.phtml。为了以防万一,我还更改了 app/design/frontend/base/default/layout/catalogsearch.xml。(我已经备份了原始文件。)

常规搜索结果页面是 2columns-left。只有高级搜索结果页面是 2columns-right。

这是我的 app/design/frontend/default/theme261/layout/catalogsearch.xml 代码:

<layout version="0.1.0">

    <default>
        <reference name="root">
            <action method="setTemplate"><template>page/2columns-left.phtml</template></action>
        </reference>
        <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>
        <reference name="left">
            <block type="sidebarsearch/advanced_sidebar" name="sidebarsearch_advanced_sidebar" template="sidebarsearch/advanced/sidebar.phtml" before="-"/>
        </reference>
    </default>

    <catalogsearch_result_index translate="label">
        <label>Quick Search Form</label>
        <reference name="root">
            <action method="setTemplate"><template>page/2columns-left.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>
        <reference name="root">
            <action method="setTemplate"><template>page/2columns-left.phtml</template></action>
        </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-left.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_left" /> -->
        <!-- Mage_Catalogsearch -->
        <reference name="root">
            <action method="setTemplate"><template>page/2columns-left.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>3</count></action>
                    <action method="addColumnCountLayoutDepend"><layout>two_columns_right</layout><count>3</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>

提前感谢您的帮助。

4

1 回答 1

1

确保:

1)您的主题theme261目前在商店使用(系统/配置/网页/设计)

2)您的任何自定义扩展都不会覆盖布局/内部的“catalogsearch_advanced_result”(在应用程序/设计/前端中找到所有出现的“catalogsearch_result_index”,它们可以在您的主题之外的“基本”主题池中)

3)刷新你的缓存


如果这没有帮助,忍者就是这样做的:

  1. 在此文件app/code/core/Mage/CatalogSearch/controllers/AdvancedController.php中,将调试添加到方法中resultAction:在右括号之前的字符串$this->renderLayout();之后 } 添加以下内容:

    if($this->getRequest()->getParam('test')){
        var_dump(Mage::app()->getLayout()->getXmlString());                                                                                                                                
        die();
    }
    
  2. 使用添加的请求参数 test=1 访问您网站上的高级搜索页面,即: www.your.site.com/catalogsearch/advanced/result/?q=some-query&test=1

  3. 以“源代码”模式查看此页面,否则您的浏览器将呈现该 xml。

这种方法的想法是寻找字符串“setTemplate”。通过这种方式,您将找出诸如某些布局更新指令是否在 xml 文件之外完成等问题。

于 2013-10-17T15:37:49.080 回答