Remove sorting from the list, or remove sorting display in Prestashop 1.7 version
Come back
29

Remove sorting from the list, or remove sorting display in Prestashop 1.7 version

In 1.7 version of Prestashop , you can remove an item from the sorting list or remove the sorting display on the category page and search page, below I will describe how you can do this. Attention, the sort list may be supplemented by an external prestashop module that you install !!!

When you open a category page or a search page, you will see the item " sort by ":

Sort display image 1

Sort display image 2

This sorting list is output by the " ps_facetedsearch - Layered Navigation" module displayed in the " displayLeftColumn " hook.

Also on the left of the page, this module displays various filters (colors, price, types, etc.)

1. Sort list template, remove display

My topic is called "classic", in this topic I will indicate the paths to the sorting template.

1) List template "sort-orders.tpl" sorts are called in the template "products-top.tpl" along the way:

/themes/classic/templates/catalog/_partials/products-top.tpl

2) And the list template itself "sort-orders.tpl" lies along the way:

/themes/classic/templates/catalog/_partials/sort-orders.tpl

3) To remove the sorting display, you will need to go to the template "products-top.tpl (/themes/classic/templates/catalog/_partials/products-top.tpl)" and comment out the call to the template "sort-orders.tpl" it will be like this:

Hide the sorting list altogether

To remove a certain sort from the list, it is better to do what I described below.

2. Changing the sort list

1) Next, in order for us to change the list, remove or add an item in the list, we need to open the file "SearchProvider.php" format php along this path

\modules\ps_facetedsearch\src\Product\SearchProvider.php

2) Further in this file you will see a list of these sortings:

Sort list code

3) There you will see a call to the SortOrder object to which values are sent by which a certain sorting will be built. The getAvailableSortOrders function returns an array of strings that are displayed on the page. For example, I need to remove the first sorting " Best sellers ", I just comment it out:

Sort comment

So you can change the list in your specified order.

created:
21.04.2021
updated:
15.11.2022
author:
admin
Tags
yandex metrika