Products default sort not working on search.tpl - Prestashop 1.6.0.6

纵然是瞬间 提交于 2019-12-24 21:08:25

问题


I set up in backoffice the default sort type to : in stock. this works for all pages except SearchController template file : search.tpl.

What can be the causes behind such dysfunctionning? I really don't know what part of code to deal with. Thanks everyone who already met such issue for advices.

Edit: I discovered that the link in the adress bar after click on search button is:

 website/index.phpcontroller=search&orderby=position&orderway=desc&search_query=design+40&submit_search=Rechercher

When I remove orderby=position&orderway=desc, the default behaviour works. I just need to remove this action from controller but still don't know how.


回答1:


In template file, I found:

<form method="get" action="{$link->getPageLink('search')|escape:'html'}" id="searchbox">
        <p>
            <label for="search_query_top"><!-- image on background --></label>
            <input type="hidden" name="controller" value="search" />
            <input type="hidden" name="orderby" value="quantity" />
            <input type="hidden" name="orderway" value="desc" />
            <input class="search_query" type="text" id="search_query_top" name="search_query" value="{$search_query|escape:'html':'UTF-8'|stripslashes}" />
            <input type="submit" name="submit_search" value="{l s='Search' mod='blocksearch'}" class="button" />
        </p>
</form>

As you see, I have already changed the value of the hidden input to quantity. Hope it helps.



来源:https://stackoverflow.com/questions/24718666/products-default-sort-not-working-on-search-tpl-prestashop-1-6-0-6

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!