Jump to content

Re-order product listings


Hornblower

Recommended Posts

Ok I'll admit it. Little things annoy me. Like how can you re-order a listign of 1 item?? However you look at it, it can only be put into a list just the 1 way.

So what to do?

on lines 22 & 85 or thereabouts you will find the following:


{if isset($PRODUCTS) && count($PRODUCTS) >= 1}





Change it to:



{if isset($PRODUCTS) && count($PRODUCTS) >= 2}

Now wasn't that easy :)

Link to comment
Share on other sites

But the other thing that I like is consistency and altering the code as above will remove the 'pagination bar' (my name for it, but I am sure you know what I meen). Inconsistancy tends to frighten some people, they think somethign has gone wrong.

So to get a little more inspired with the code, change the whole code block to


{if isset($PRODUCTS)}

<form action="{$VAL_SELF}" method="post">

  <div class="control">

<span class="pagination">{if isset($PAGINATION)}{$PAGINATION}{/if}</span>

    {if count($PRODUCTS) >= 2}

{if isset($SORTING)}

{$LANG.form.sort_by}

<select name="sort" class="auto_submit">

   <option value="">{$LANG.form.please_select}</option>

   {foreach from=$SORTING item=sort}

   <option value="{$sort.field}|{$sort.order}" {$sort.selected}>{$sort.name} ({$sort.direction})</option>

   {/foreach}

</select>

	 {/if}

<input type="submit" value="{$LANG.form.sort}" />

    {else}

    &nbsp;

{/if}

  </div>

</form>

{/if}

You will notice that there is an extra {else} near the botom of the code block. This is so that if there is no sorting or pagination code this 'pagination bar' doesn't collapse on itself as without the optional &nbsp; (non-breaking space) there would be nothing to style.

Link to comment
Share on other sites

  • 2 months later...

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.   Paste as plain text instead

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