X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Looping (https://forum.x-cart.com/showthread.php?t=14672)

whsu716 06-20-2005 07:16 AM

Looping
 
Hello All!

Below is part of my products.tpl file...
what do: gt & lt stand for?



Quote:


{if $usertype eq "C" and $config.Appearance.products_per_row ne "" and $config.Appearance.products_per_row gt 0 and $config.Appearance.products_per_row lt 4 and ($featured eq "Y" or $config.Appearance.featured_only_multicolumn eq "N")}
{include file="customer/main/products_tTest.tpl" products=$products}


{

balinor 06-20-2005 07:17 AM

Greater Than and Less Than ;)

whsu716 06-20-2005 08:20 AM

hahah that was simple. Thanks.

Now here is the actual looping question. Below is taken from my products_t.tpl...

Quote:

{* $Id: products_t.tpl,v 1.10.2.7 2004/12/23 09:11:59 max Exp $ *}
<TABLE border="0" width="100%" cellpadding="0" cellspacing="0" class="VertMenuBorder"><TR><TD class="TableThumbnailBorder">

<TABLE border="0" width="100%" cellpadding="5" cellspacing="1">

{math equation="floor(100/x)" x=$config.Appearance.products_per_row assign="width"}

{section name=product loop=$products}
{assign var="discount" value=0}

{if %product.index% is div by $config.Appearance.products_per_row}
<TR>
{assign var="cell_counter" value=0}
{/if}

{math equation="x+1" x=$cell_counter assign="cell_counter" }

<TD align="center" valign="top" width="{$width}%" class="DialogBox">


It loops through ALL featured products, but I just want it to take only 3 products...any thoughts?

whsu716 07-10-2005 07:02 PM

Maybe this one is easier to answer...

Quote:

<table border="0" cellpadding="0" cellspacing="0" width="760px" style="margin-top: 1px; border-bottom: 1px solid #cccccc; padding-bottom: 7px;">
<tr>
<td style="margin-left: 2px;" align="right">
{section name=sb loop=$speed_bar }
{if $speed_bar[sb].active eq "Y"}
{include file="customer/tabTest.tpl" tab_title="<A href=\"`$speed_bar[sb].link`\">`$speed_bar[sb].title`</A>"}
{/if}
{/section}
</td>
</tr>
</table>

As of now, it prints every speed bar onto one line...like this:

line1 line2 line3 line4 line5 line6 line7 line8


But I would like this:

line1 line2 line3 line4
line5 line6 line7 line8

whsu716 07-13-2005 08:09 PM

anyone???

Gibberish 07-13-2005 08:13 PM

Maybe something like this?
Code:

<table border="0" cellpadding="0" cellspacing="0" width="760px" style="margin-top: 1px; border-bottom: 1px solid #cccccc; padding-bottom: 7px;">
<tr>
<td style="margin-left: 2px;" align="right">
{section name=sb loop=$speed_bar }
{if $speed_bar[sb].active eq "Y"}
  {include file="customer/tabTest.tpl" tab_title="<A href=\"`$speed_bar[sb].link`\">`$speed_bar[sb].title`</A>"}
{if %sb.index% is div 4}
{/if}
{/if}
{/section}
</td>
</tr>
</table>


TelaFirma 07-14-2005 03:25 AM

Quote:

Originally Posted by yoyonation
hahah that was simple. Thanks.

Now here is the actual looping question. Below is taken from my products_t.tpl...

Quote:

{* $Id: products_t.tpl,v 1.10.2.7 2004/12/23 09:11:59 max Exp $ *}
<TABLE border="0" width="100%" cellpadding="0" cellspacing="0" class="VertMenuBorder"><TR><TD class="TableThumbnailBorder">

<TABLE border="0" width="100%" cellpadding="5" cellspacing="1">

{math equation="floor(100/x)" x=$config.Appearance.products_per_row assign="width"}

{section name=product loop=$products}
{assign var="discount" value=0}

{if %product.index% is div by $config.Appearance.products_per_row}
<TR>
{assign var="cell_counter" value=0}
{/if}

{math equation="x+1" x=$cell_counter assign="cell_counter" }

<TD align="center" valign="top" width="{$width}%" class="DialogBox">


It loops through ALL featured products, but I just want it to take only 3 products...any thoughts?



Change the line
Code:

{section name=product loop=$products}

to

Code:

{section name=product loop=$products max=3}


All times are GMT -8. The time now is 03:32 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.