Magento Search不适用于magento 1.9

时间:2014-12-24 13:38:40

标签: php magento search magento-1.9

我尝试了以下方法: -

1)系统变更 - >配置 - >目录搜索设置从喜欢和喜欢和全文并回到喜欢。

2)重新索引数据

3)刷新Magento缓存。

一切都没用。

我对catalogsearch.xml的代码是

<?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_first">
     <!--   <block type="catalogsearch/layer" name="catalogsearch.leftnav" after="currency" template="catalog/layer/view.phtml">
            <block type="core/text_list" name="catalog.leftnav.state.renderers" as="state_renderers" />
        </block> -->
    </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="core/text_list" name="product_list.name.after" as="name.after" />
                <block type="core/text_list" name="product_list.after" as="after" />
                <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>

<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="core/text_list" name="product_list.name.after" as="name.after" />
                <block type="core/text_list" name="product_list.after" as="after" />
                <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>

我正在进行搜索的header.phtml文件是

<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @category    design
 * @package     rwd_default
 * @copyright   Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
/**
 * @var Mage_Page_Block_Html_Header $this
 */
?>


 <!-- Header -->
    <div class="header-section">
        <div class="header-panel">
        <div class="nav-btn"></div>
            <div class="logo">
                <a href="<?php echo $this->getUrl('') ?>"><img src="<?php echo $this->getLogoSrc() ?>" alt=" $this->getLogoAlt()" /></a>
            </div>
            <div class="top-links"><a href="/ds4u/sales/guest/form/">ORDER TRACKING</a>
              <?php $helper = Mage::helper('customer'); ?>
                <?php if ($helper->isLoggedIn()) : ?>
                <a href="<?php echo $helper->getLogoutUrl(); ?>"><?php echo $this->__('Logout');?></a>
            <?php else :?>
                <a href="<?php echo $helper->getLoginUrl(); ?>"><?php echo $this->__('Sign In');?></a> 
                <a href="<?php echo $helper->getRegisterUrl(); ?>"><?php echo $this->__('Register');?></a>
            <?php endif; ?>
            <?php echo $this->getAdditionalHtml(); ?></div>
            <div class="box1">
                <div class="phone-no">
                    <span class="icon"></span>

                </div>
                <?php echo $this->getChildHtml('topSearch') ?>
            </div>
            <div class="box2">
                <div class="links">
                        <?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('header_content')->toHtml() ?>
                </div>
                <div class="checkout">
                    <div class="amount">Basket <?php echo $this->helper('checkout')->formatPrice(Mage::getSingleton('checkout/cart')->getQuote()->getGrandTotal()); ?><span class="currency">£ $</span></div>
                    <button type="button" class="btn"><a href="<?php echo Mage::getUrl('checkout/cart'); ?>">CHECKOUT</a></button>
                </div>
            </div>
            <div class="box3">
                <a href="#" class="phone"></a>
                <a href="#" class="search"></a>
                <a href="<?php echo Mage::getUrl('checkout/cart'); ?>" class="checkout"></a>
                <a href="#" class="account"></a>
            </div>
        </div>
    </div>
    <!------------>

    <!-- Dropdown -->
   <div class="dropdown">
        <div class="search-box">
           <?php echo $this->getChildHtml('topSearch') ?>
        </div>
        <div class="account-box">
        <?php $helper = Mage::helper('customer'); ?>
                <?php if ($helper->isLoggedIn()) : ?>
                <a href="<?php echo $helper->getLogoutUrl(); ?>"><?php echo $this->__('Logout &gt;');?></a>
            <?php else :?>
                <a href="<?php echo $helper->getLoginUrl(); ?>"><?php echo $this->__('Sign In &gt;');?></a> 
                <a href="<?php echo $helper->getRegisterUrl(); ?>"><?php echo $this->__('Register &gt;');?></a>
            <?php endif; ?>
            <?php echo $this->getAdditionalHtml(); ?>
            <a href="/ds4u/sales/guest/form/">ORDER TRACKING &gt;</a>
        </div>
    </div>
    <!--End Header-->
     <div class="skip-links">
            <a href="#header-nav" class="skip-link skip-nav">
                <span class="icon"></span>
                <span class="label"><?php echo $this->__('Menu'); ?></span>
            </a>

            </div>

        <!-- Navigation -->

        <div id="header-nav" class="skip-content">
            <?php echo $this->getChildHtml('topMenu') ?>
        </div>

        <!-- Search -->

        <!-- Cart -->

        <!-- <div id="header-cart" class="skip-content">
            <div class="mini-cart">
                <div class="menu-wrapper">
                    <div class="menu cart-menu">
                        <div class="empty">Your cart is empty.</div>
                    </div>
                </div>
            </div>
        </div> -->
    </div>
</header>


<?php echo $this->getChildHtml('topContainer'); ?>

1 个答案:

答案 0 :(得分:1)

我已经解决了搜索无法正常工作的问题。

我尝试了问题评论中陈述的所有上述内容,但之后我想出了一个解决方案,将catalogsearch.xml文件与基本catalogsearch.xml文件进行比较,解决了我的问题。

问题是我在该文件中评论了两个块。

为了进一步参考,我写了一个带截图的博客; Magento Search Not working