PHP HTML购物车,使用HTML模板
我试图修改以下代码以显示所有自定义字段。这段代码只显示有价格的自定义字段,但我想显示所有自定义字段,包括免费字段PHP HTML购物车,使用HTML模板,php,html,templates,field,Php,Html,Templates,Field,我试图修改以下代码以显示所有自定义字段。这段代码只显示有价格的自定义字段,但我想显示所有自定义字段,包括免费字段 <td valign="top">{$contents[0].category_name} - <strong>{$contents[0].name}</strong> {if $contents[2][0]}({$contents[2][0].name}){/if}<br/> </td>
<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">{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>
{/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>
但我不知道怎么做。我希望有人能在这个问题上帮助我
谢谢。您是否尝试过删除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}
{if$cart\u contents[1]}
{foreach from=$cart_contents[1]item=cstom}
{$cstom.fullname}
{if$cstom.setup!=0}{$cstom.setup |价格:$currency}{else}-{/if}
{if$cstom.price==0}{$lang.Free}{elseif$cstom.prorata_amount}{$cstom.prorata_amount}{$cstom.price:$currency}{else}{$cstom.price}price:$currency}{/if}
{/foreach}
{/if}
而且“dunno”并不是一个真正的词。你好,McWafflestix,我编辑了我的帖子,只是围绕着代码写的,希望现在一切正常。。。。坎布拉卡不知道这个词的意思是我不知道。。。。感谢Sven Almgren的回复,但我之前尝试过,当我删除整个代码时,页面没有加载
{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}