![]() |
modifying or creating a new {section name=product loop=$products}
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. |
Re: modifying or creating a new {section name=product loop=$products}
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} |
All times are GMT -8. The time now is 11:59 PM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.