View Single Post
  #1  
Old 09-12-2007, 10:26 AM
 
toomnyhats toomnyhats is offline
 

Advanced Member
  
Join Date: Sep 2006
Posts: 41
 

Default Function for sorting array

Hello,

I am trying to implement a table to show product variants so a customer doesn't have to click the dropdown to see the price. I have the table functioning, however, I would like it to be sorted by price (lowest first). This is how it is appearing now:

http://mermaids-natural-skin-care.com/images/Sizes.gif

Does anybody know how I can put a sort (lowest price 1st) into the following code:

{***BEGIN Mod to add Variant Table***}
{if $variants ne ""}
<tr id="product_weight_box">
<td width="30%">&nbsp;</td>
<td nowrap="nowrap">&nbsp;</td>
</tr>
<table width="100%" cellpadding="0" cellspacing="0"><tr><td colspan="4"><b><font class="ProductDetailsTitle">{$lng.lbl_AvailableSiz es}</font></b></td></tr>
<tr><td class="Line" height="1" colspan="4"><img src="{$ImagesDir}/spacer.gif" class="Spc" alt="" /><br></td></tr>
<tr><td colspan="4">&nbsp;</td></tr>
<tr>
{foreach name=variants from=$variants item=tempVar}
<td colspan="4">
{foreach from=$tempVar.options item=tempOpt}
<tr>
<td width="45%">
{$tempOpt.option_name}
</td>
<td align="left" width="5%">
{include file="currency.tpl"}
</td>
<td align="right" width="10%">
{$tempVar.price}
</td>
<td align="right" >
&nbsp;</td>
</tr>
{/foreach}
</td>
{if $smarty.foreach.variants.iteration is div by 3}
</tr>
<tr>
{elseif not $smarty.foreach.variants.last}
<td width="30%"></td>
{/if}
{/foreach}
</tr>
</table>
{/if}
{***END Mod to Add Variant Table***}


Thanks so much!
__________________
toomnyhats
X-Cart Gold 4.1.9 (Unix)
X-SpecialOffers
DSEFU (disabled)
Reply With Quote