Jump to content
krapo

Remove item from "Sort by" function in products page

Recommended Posts

Hi everyone,

 

I have an issue with Prestashop 1.7 (knew how to do with 1.6, but with the new one):

I would like to remove "Relevance" from the list of Sort by options in the products listing page.

Does someone have any clue about how to proceed?

 

Many thanks,

 

Noe

 

Share this post


Link to post
Share on other sites

Not sure about removing just 1 sort option...but the entire drop down menu can be removed by editing the file:

 

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

 

modify the line:

 
<span class="col-sm-3 col-md-3 hidden-sm-down sort-by">{l s='Sort by:' d='Shop.Theme'}</span>
 
to be

 

<span class="col-sm-3 col-md-3 hidden-sm-down sort-by">{l s=' ' d='Shop.Theme'}</span>

 

then delete the rest of the file below this line.

 

Make a backup of your original file 1st just in case.

Edited by kellyriverstone (see edit history)

Share this post


Link to post
Share on other sites

I have been trying the same but can´t remove just one sort option. Still figuring out how to do it. 

 

Like kellyriverstone says yo can remove the entire dropdown, but I have done it in a different way.

 

Edit this file:

 

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

 

Delete or comment this lines:

 
<div class="box-sort-by">
      {block name='sort_by'}
        {include file='catalog/_partials/sort-orders.tpl' sort_orders=$listing.sort_orders}
      {/block}
  </div>

 

After that it is recommended to delete the border-right and padding of the "total products" display div. 

You can do that editing the style.css of your template.

In my case this is what i did:

 

.products-selection .total-products p{
margin: 5px 0;
/*border-right: 1px solid #666;*/
margin-right: 8px;
padding-right:8px;
line-height: 13px;
}
 
I have "commented" the line of the border and modified the margin-right and padding-right attributes. 
 
Hope it helps.

Share this post


Link to post
Share on other sites

In regards to the sort If I wanted to have one page which is also a category 

 

not sorted by Item Name and to be freely sorted by the order, i place how would I do that?

Share this post


Link to post
Share on other sites
On 5/13/2017 at 4:15 AM, krapo said:

Hi everyone,

 

I have an issue with Prestashop 1.7 (knew how to do with 1.6, but with the new one):

I would like to remove "Relevance" from the list of Sort by options in the products listing page.

Does someone have any clue about how to proceed?

 

Many thanks,

 

Noe

 

I have a temporary 'fix' - to comment out the relevant line in "/modules/ps_facetedsearch/src/Ps_FacetedsearchProductSearchProvider.php":

    private function getAvailableSortOrders()
    {
        return [
//            (new SortOrder('product', 'position', 'asc'))->setLabel(
//                $this->module->getTranslator()->trans('Relevance', array(), 'Modules.Facetedsearch.Shop')
//            ),
            (new SortOrder('product', 'name', 'asc'))->setLabel(
                $this->module->getTranslator()->trans('Name, A to Z', array(), 'Shop.Theme.Catalog')
            ),
            (new SortOrder('product', 'name', 'desc'))->setLabel(
                $this->module->getTranslator()->trans('Name, Z to A', array(), 'Shop.Theme.Catalog')
            ),
            (new SortOrder('product', 'price', 'asc'))->setLabel(
                $this->module->getTranslator()->trans('Price, low to high', array(), 'Shop.Theme.Catalog')
            ),
            (new SortOrder('product', 'price', 'desc'))->setLabel(
                $this->module->getTranslator()->trans('Price, high to low', array(), 'Shop.Theme.Catalog')
            ),
        ];
    }

You should probably override the function for a more permanent fix, but pretty new to Prestashop, so not sure how!

Hope that helps though if a little late to the party!

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More