【问题标题】:Two Search bars on one page in magentomagento 一页上有两个搜索栏
【发布时间】:2014-03-15 21:19:17
【问题描述】:

我正在一个网站上工作,我想在一个页面上集成两次 Magento 默认搜索。我有两个搜索字段并想从两个商店进行搜索。那可能吗 ?

我可以为一家商店做到这一点,默认 Magento 也一次支持一家商店。如果有人提出一些提示或指南,我们将不胜感激。

【问题讨论】:

  • 你想在页面中搜索两次...???
  • @AmitBera 是的。
  • 页面中有搜索框???
  • @AmitBera 但是不同的商店怎么样?意味着他们将搜索相同的项目,但我想为每个项目搜索不同的项目。希望你明白我的意思

标签: magento search


【解决方案1】:

您可以使用以下代码尝试博客文件...

<?php
echo $this->getLayout()->createBlock('core/template')->setTemplate('catalogsearch/form.mini.phtml')->toHtml() ?>
?>

【讨论】:

  • 你收到我的问题了吗?
  • 根据你的位置调用页面中的代码序列次
【解决方案2】:

您可以尝试在搜索操作中使用查询字符串参数来更改商店视图。将下面的YOUR_STORE 替换为您要搜索的商店查看代码。这会将您带到另一家商店的搜索结果。

<form id="search_mini_form" action="/index.php/catalogsearch/result/?___store=YOUR_STORE" method="get">
<div class="form-search">
    <label for="search">Search:</label>
    <input id="search" type="text" name="q" value="" class="input-text" maxlength="128" autocomplete="off">
    <button type="submit" title="Search" class="button"><span><span>Search</span></span></button>
    <div id="search_autocomplete" class="search-autocomplete" style="display: none;"></div>
    <script type="text/javascript">
    //<![CDATA[
        var searchForm = new Varien.searchForm('search_mini_form', 'search', 'Search entire store here...');
        searchForm.initAutocomplete('/index.php/catalogsearch/ajax/suggest/', 'search_autocomplete');
    //]]>
    </script>
</div>
</form>

如果您想将两组搜索结果集成到一个搜索结果页面中,则需要进行一些额外的编码。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-07-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-07-21
    相关资源
    最近更新 更多