PHP HTML cart, using HTML template
I'm trying to modify the following code to show all custom fields. This code shows only the custom fields that have a price, but I want to show all the custom fields including the free ones.
<td valign="top">{$contents[0].category_name} - <strong>{$contents[0].name}</strong> {if $contents[2][0]}({$contents[2][0].name}){/if}<br/>
</td>
<td align="center">{if $contents[0].setup!=0}{$contents[0].setup|price:$currency}{else}-{/if}</td>
<td align="center">{if $contents[0].price==0}<strong>{$lang.Free}</strong>{elseif $contents[0].prorata_amount}
<strong> {$contents[0].prorata_amount|price:$currency}</strong>
({$lang.prorata} {$contents[0].prorata_date|dateformat:$date_format}){else}<strong>{$contents[0].price|price:$currency}</strong>{/if}</td>
</tr>
{/if}
{if $cart_contents[1]}
{foreach from=$cart_contents[1] item=cstom}
{if $cstom.total>0}
<tr >
<td valign="top" class="blighter fs11" style="padding-left:15px">{$cstom.fullname}<br/>
</td>
<td align="center" class="blighter fs11">{i开发者_StackOverflow社区f $cstom.setup!=0}{$cstom.setup|price:$currency}{else}-{/if}</td>
<td align="center" class="blighter fs11"><strong>{if $cstom.price==0}{$lang.Free}{elseif $cstom.prorata_amount}{$cstom.prorata_amount|price:$currency}{else}{$cstom.price|price:$currency}{/if}</strong></td>
</tr>
{/if}
{/foreach}
{/if}
{if $contents[3]}
{foreach from=$contents[3] item=addon}
<tr >
<td>{$lang.addon} <strong>{$addon.name}</strong></td>
<td align="center">{if $addon.setup!=0}{$addon.setup|price:$currency}{else}-{/if}</td>
<td align="center">{if $addon.price==0}<strong>{$lang.Free}</strong>{elseif $addon.prorata_amount}<strong>{$addon.prorata_amount|price:$currency}</strong> ({$lang.prorata} {$addon.prorata_date|dateformat:$date_format}){else}<strong>{$addon.price|price:$currency}</strong>{/if}</td>
I guess I should modify this area at line 39
{if $cart_contents[1]}
{foreach from=$cart_contents[1] item=cstom}
{if $cstom.total>0}
But I don't know how to do it. I hope someone help me regarding this issue.
Thanks.
Have you tried just removing the if
{if $cart_contents[1]}
{foreach from=$cart_contents[1] item=cstom}
<tr >
<td valign="top" class="blighter fs11" style="padding-left:15px">{$cstom.fullname}<br/>
</td>
<td align="center" class="blighter fs11">{if $cstom.setup!=0}{$cstom.setup|price:$currency}{else}-{/if}</td>
<td align="center" class="blighter fs11"><strong>{if $cstom.price==0}{$lang.Free}{elseif $cstom.prorata_amount}{$cstom.prorata_amount|price:$currency}{else}{$cstom.price|price:$currency}{/if}</strong></td>
</tr>
{/foreach}
{/if}
精彩评论