Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Numbering in Bestseller

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 04-25-2008, 08:32 AM
  yamiya's Avatar 
yamiya yamiya is offline
 

Member
  
Join Date: Aug 2007
Posts: 24
 

Default Numbering in Bestseller

What I trying to achieve is to add a simple counter such that it will label bestseller column in such a form.

1. A product
2. B product
3. C product
.
.
.

Anyone knows how to create a simple counter for .tpl file?


{* $Id: bestsellers.tpl,v 1.8.2.1 2006/11/16 13:12:29 max Exp $ *}
{if $bestsellers}
{capture name=bestsellers}
<table cellpadding="0" cellspacing="2">
{foreach from=$bestsellers item=bestseller}
<tr>
{if $config.Bestsellers.bestsellers_thumbnails eq "Y"}
<td width="30">
<a href="product.php?productid={$bestseller.productid }&amp;cat={$cat}&amp;bestseller">{include file="product_thumbnail.tpl" productid=$bestseller.productid image_x=90 product=$bestseller.product}</a>
</td>
{/if}
<td>
<b><a href="product.php?productid={$bestseller.productid }&amp;cat={$cat}&amp;bestseller">{$bestseller.prod uct}</a></b><br />
{$lng.lbl_our_price}: {include file="currency.tpl" value=$bestseller.taxed_price}<br />
</td>
</tr>
{/foreach}
</table>
{/capture}
{include file="dialog.tpl" title=$lng.lbl_bestsellers content=$smarty.capture.bestsellers extra='width="100%"'}
{/if}
__________________
Yamiya Yam
http://www.yamiya.com.my
---------------------------------------
X-Cart Gold v4.1.8 (UNIX)
Reply With Quote
  #2  
Old 04-25-2008, 03:47 PM
  kube's Avatar 
kube kube is offline
 

X-Adept
  
Join Date: Sep 2005
Location: London: a small place East of Wales
Posts: 529
 

Default Re: Numbering in Bestseller

hi yamiya,

You can either add a name to the foreach and count the iterations like so...

{foreach from=$bestsellers item=bestseller name=thisloop}
{$smarty.foreach.thisloop.iteration}.
{/foreach}

or you could use {counter}.

Hope this helps.
__________________
Doms
kube v4.1.9
Reply With Quote
  #3  
Old 04-25-2008, 10:29 PM
  yamiya's Avatar 
yamiya yamiya is offline
 

Member
  
Join Date: Aug 2007
Posts: 24
 

Thumbs up Re: Numbering in Bestseller

many thanks. it's working seamlessly now

http://www.yamiya.com.my

Quote:
Originally Posted by kube
hi yamiya,

You can either add a name to the foreach and count the iterations like so...

{foreach from=$bestsellers item=bestseller name=thisloop}
{$smarty.foreach.thisloop.iteration}.
{/foreach}

or you could use {counter}.

Hope this helps.
__________________
Yamiya Yam
http://www.yamiya.com.my
---------------------------------------
X-Cart Gold v4.1.8 (UNIX)
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 04:19 AM.

   

 
X-Cart forums © 2001-2020