Jump to content

Simple question, but can't get it myself... HELP


Neoxide

Recommended Posts

if someone can help me out with this, its quite simple but I can't seem to get it to work..

 

Basically, this is the code I have for now, the issue is if I have 0 product or items, I don't want the sorting option to show up on the page,    from the code below, what line can I add tosay that if there is no products in a category, not to show the SORT feature.

 

thanks in advance if anyone can help.

 

 

{if isset($orderby) AND isset($orderway)}

<!-- Sort products -->

{if isset($smarty.get.id_category) && $smarty.get.id_category}

{assign var='request' value=$link->getPaginationLink('category', $category, false, true)}

{elseif isset($smarty.get.id_manufacturer) && $smarty.get.id_manufacturer}

{assign var='request' value=$link->getPaginationLink('manufacturer', $manufacturer, false, true)}

{elseif isset($smarty.get.id_supplier) && $smarty.get.id_supplier}

{assign var='request' value=$link->getPaginationLink('supplier', $supplier, false, true)}

{else}

{assign var='request' value=$link->getPaginationLink(false, false, false, true)}

{/if}

<form id="productsSortForm" action="{$request|escape:'htmlall':'UTF-8'}">

<select id="selectPrductSort" onchange="document.location.href = $(this).val();">

<option value="{$link->addSortDetails($request, $orderbydefault, $orderwaydefault)|escape:'htmlall':'UTF-8'}" {if $orderby eq $orderbydefault}selected="selected"{/if}>{l s='--'}</option>

{if !$PS_CATALOG_MODE}

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

{/if}

<option value="{$link->addSortDetails($request, 'name', 'asc')|escape:'htmlall':'UTF-8'}" {if $orderby eq 'name' AND $orderway eq 'asc'}selected="selected"{/if}>{l s='Product 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='Product Name: Z to A'}</option>

{if !$PS_CATALOG_MODE}

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

{/if}

</select>

<label for="selectPrductSort">{l s='Sort by'}</label>

</form>

<!-- /Sort products -->

{/if}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

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

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.