Jump to content

[SOLVED] "Sort by" links instead of Dropdown


Recommended Posts

Try changing lines 12-24 of product-sort.tpl from:

<form id="productsSortForm" action="{$request}">



{l s='--'}
{l s='price: lowest first'}
{l s='price: highest first'}
{l s='name: A to Z'}
{l s='name: Z to A'}
{l s='in-stock first'}

{l s='sort by'}

</form>



to:


{l s='sort by'}
<a href="{$link->addSortDetails($request, 'position', $orderwayposition)|escape:'htmlall':'UTF-8'}">{l s='--'}
<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, 'name', 'asc')|escape:'htmlall':'UTF-8'}">{l s='name: A to Z'}
<a href="{$link->addSortDetails($request, 'name', 'desc')|escape:'htmlall':'UTF-8'}">{l s='name: Z to A'}
<a href="{$link->addSortDetails($request, 'quantity', 'desc')|escape:'htmlall':'UTF-8'}">{l s='in-stock first'}



That should hopefully display them as links instead of a dropdown. I'm not sure how it will look though.

Link to comment
Share on other sites

  • 3 years later...

Try changing lines 12-24 of product-sort.tpl from:

 

<form id="productsSortForm" action="{$request}">    <p class="select">        <select id="selectPrductSort">            <option value="{$link->addSortDetails($request, 'position', $orderwayposition)|escape:'htmlall':'UTF-8'}" {if $orderby eq 'position'}selected="selected"{/if}>{l s='--'}</option>            <option value="{$link->addSortDetails($request, 'price', 'asc')|escape:'htmlall':'UTF-8'}" {if $orderby eq 'price'    AND $orderway eq 'ASC' }selected="selected"{/if}>{l s='price: lowest first'}</option>            <option value="{$link->addSortDetails($request, 'price', 'desc')|escape:'htmlall':'UTF-8'}" {if $orderby eq 'price'    AND $orderway eq 'DESC'}selected="selected"{/if}>{l s='price: highest first'}</option>            <option value="{$link->addSortDetails($request, 'name', 'asc')|escape:'htmlall':'UTF-8'}" {if $orderby eq 'name'     AND $orderway eq 'ASC' }selected="selected"{/if}>{l s='name: A to Z'}</option>            <option value="{$link->addSortDetails($request, 'name', 'desc')|escape:'htmlall':'UTF-8'}" {if $orderby eq 'name'     AND $orderway eq 'DESC'}selected="selected"{/if}>{l s='name: Z to A'}</option>            <option value="{$link->addSortDetails($request, 'quantity', 'desc')|escape:'htmlall':'UTF-8'}" {if $orderby eq 'quantity' AND $orderway eq 'DESC' }selected="selected"{/if}>{l s='in-stock first'}</option>        </select>        <label for="selectPrductSort">{l s='sort by'}</label>    </p></form>

to:

 

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

That should hopefully display them as links instead of a dropdown. I'm not sure how it will look though.

 

Thanks,

Iinks working fine but issue i am facing is that total page gets reloaded and the selected filters gets cleared.

Any suggestions to get rid of this issue.

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...