View Single Post
  #8  
Old 07-29-2003, 07:58 AM
 
funkydunk funkydunk is offline
 

X-Man
  
Join Date: Oct 2002
Location: Cambridge, UK
Posts: 2,210
 

Default

Little known secret shhhh...

but you can get it do do an ascending sort by price by adding a link to the product page with additional variable of:

Code:
&orderby=price
Job done

same goes with alphabetically

Code:
&orderby=product

Now for one site I just added a table into the top of the products.tpl such as:

Code:
{* custom mod *} {if $products ne ""} <table border="0" cellspacing="0" cellpadding="2" width="100%"> <tr> <td valign="top" align="center" colspan="4"> Sort by: </td> </tr> <tr> <td valign="top" align="center"> Price </td> <td valign="top" align="center"> Product Name </td> <td valign="top" align="center"> Brand </td> <td valign="top" align="center"> Date Added </td> </tr> </table> {/if} {* end of custom mod *}
Now this uses the brand field in the database but xcart does not have that switched on as standard.

You will also need to add:

Code:
// funkydunk mod - added in so that sorting can carry forward across the pages $smarty->assign("orderby",$orderby);

into the bottom of customer/products.php

and change navigation.tpl to the following so that the orderby variable is carried over to the next page:

Code:
{* $Id: navigation.tpl,v 1.6 2002/10/22 10:27:05 olga Exp $ *} {if $total_pages gt 2} <table cellpadding=0 border=0> <tr height=14> {section name=page loop=$total_pages start=1} {if %page.index% eq 1} <td>{$lng.lbl_result_pages}: </td> {if $navigation_page gt 1} <td valign=middle>[img]{$ImagesDir}/larrow.gif[/img]</td> {/if} {/if} {if %page.index% eq $navigation_page} <td align=center> {%page.index%} </td> {else} <td width=17 background="{$ImagesDir}/page.gif" align=center> {%page.index%} </td> {/if} {if %page.last%} {capture name=total_pages_minus} {math equation="pages-1" pages=$total_pages} {/capture} {if $navigation_page lt $smarty.capture.total_pages_minus} <td valign=middle>[img]{$ImagesDir}/rarrow.gif[/img]</td> {/if} {/if} {/section} </tr></table> {/if}
__________________
ex x-cart guru
Reply With Quote