| ||||||||||
![]() |
Shopping cart software Solutions for online shops and malls | |||||||||
![]() |
![]() |
|
X-Cart Home | ![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
modifying or creating a new {section name=product loop=$products} | |||
![]() |
|
|
Thread Tools | Search this Thread |
#1
|
|||||||||
|
|||||||||
![]() This is what I have on products.tpl:
<table class="productlisttable"> <tr> <th>Part #</th> {section name=product loop=$products} {if $products[product].extra_fields ne ''} {foreach from=$products[product].extra_fields item=extra_field} {if $extra_field.value ne ''} <th>{$extra_field.field}</th> {/if} {/foreach} {/if} {/section} <th>{$lng.lbl_price}</th> <th>Order Qty.</th> </tr> {section name=product loop=$products} <tr {cycle values="class='odd', class='even'"}> <td> {$products[product].productcode} </td> {if $products[product].extra_fields ne ''} {foreach from=$products[product].extra_fields item=extra_field} {if $extra_field.value ne ''} <td>{$extra_field.value}</td> {/if} {/foreach} {/if} <td> {include file="currency.tpl" value=$products[product].taxed_price} </td> </tr> {/section} </table> Is there a way to change the first {section name=product loop=$products} to stop after it has looked at one product, or something else entirely that I can use? All the products in the category have the same extra fields, so it would work if I could get it to stop looping all of the products. It has to by dynamic, as the store has over 1000 categories. I can't go in and type all the values for each <th>. thanks. |
|||||||||
#2
|
|||||||||
|
|||||||||
![]() Got it. It was a simple if statement with .first like so:
{section name=product loop=$products} {if $smarty.section.product.first} {foreach from=$products[product].extra_fields item=extra_field name=field} {if $extra_field.value ne ''} <th>{$extra_field.field}</th> {/if} {/foreach} {/if} {/section} |
|||||||||
|
|||
X-Cart forums © 2001-2020
|