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

modifying or creating a new {section name=product loop=$products}

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 06-18-2008, 04:29 AM
  DrQuietus's Avatar 
DrQuietus DrQuietus is offline
 

Advanced Member
  
Join Date: Dec 2005
Posts: 81
 

Default 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.
__________________
Dave Jones
dave@industrialwebworks.net
Mostly 4.7.2 - 4.7.5
Reply With Quote
  #2  
Old 06-18-2008, 10:33 PM
  DrQuietus's Avatar 
DrQuietus DrQuietus is offline
 

Advanced Member
  
Join Date: Dec 2005
Posts: 81
 

Default 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}
__________________
Dave Jones
dave@industrialwebworks.net
Mostly 4.7.2 - 4.7.5
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 11:34 AM.

   

 
X-Cart forums © 2001-2020