Jump to content

"Sort by" links instead of Dropdown working on page refresh


Rollaen

Recommended Posts

Hello everyone


I am trying to change select options by links as described in topic: https://www.prestashop.com/forums/topic/76921-solved-sort-by-links-instead-of-dropdown/

When I change the original code:

<form id="productsSortForm{if isset($paginationId)}_{$paginationId}{/if}" action="{$request|escape:'html':'UTF-8'}" class="productsSortForm">

      <label for="selectProductSort{if isset($paginationId)}_{$paginationId}{/if}">{l s='Sort by'}</label>
      <select id="selectProductSort{if isset($paginationId)}_{$paginationId}{/if}" class="selectProductSort form-control">
            {if !$PS_CATALOG_MODE}
            <option value="price:asc"{if $orderby eq 'price' AND $orderway eq 'asc'} selected="selected"{/if}>{l s='Price: Lowest first'}</option>
            <option value="price:desc"{if $orderby eq 'price' AND $orderway eq 'desc'} selected="selected"{/if}>{l s='Price: Highest first'}</option>
         {/if}

         {if $PS_STOCK_MANAGEMENT && !$PS_CATALOG_MODE}
            <option value="quantity:desc"{if $orderby eq 'quantity' AND $orderway eq 'desc'} selected="selected"{/if}>{l s='In stock'}</option>
         {/if}
      </select>

</form>



With this code:

{l s='sort by'}
<a href="{$link->addSortDetails($request, 'price', 'asc')|escape:'htmlall':'UTF-8'}">{l s='price: lowest first'}
<a href="{$link->addSortDetails($request, 'price', 'desc')|escape:'htmlall':'UTF-8'}">{l s='price: highest first'}
<a href="{$link->addSortDetails($request, 'quantity', 'desc')|escape:'htmlall':'UTF-8'}">{l s='in-stock first'}



Nevertheless selecting additional option from layered-sort list or on page refresh or swapping to another (i.e. 2 page) results in resetting the chosen link.


Thanks in advance for any help (PS version 1.6.1.6)

Rob

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...