业务功能要求:
在促销商品详细页上,当存在促销价格时就将本店售价隐藏;
但在其它商品详细页上,没有促销价格而只显示本店售价即可。
修改goods.dwt模板文件即可实现
大概在第300行:
<!–{if $goods.is_promote and $goods.gmt_end_time } 促销–>
{insert_scripts files=’lefttime.js’}
<li style=”margin-bottom:5px; border-bottom:1px dashed #ccc;”>
<strong>{$lang.promote_price}</strong><font>{$goods.promote_price}</font><br />
<strong>{$lang.residual_time}</strong>
<font id=”leftTime”>{$lang.please_waiting}</font><br />
</li>
<!–{/if}–>
修改成如下代码:
<!–{if $goods.is_promote and $goods.gmt_end_time } 促销–>
{insert_scripts files=’lefttime.js’}
<li style=”margin-bottom:5px; border-bottom:1px dashed #ccc;”>
<strong>{$lang.promote_price}</strong><font>{$goods.promote_price}</font><br />
<strong>{$lang.residual_time}</strong>
<font id=”leftTime”>{$lang.please_waiting}</font><br />
</li>
{else}
<!–本店售价–>
<strong>{$lang.shop_price}</strong><font id=”ECS_SHOPPRICE”>{$goods.shop_price_formated}</font><br />
<!–{/if}–>
同时,把第270行这段代码删除(以免重复显示)
<!–本店售价–>
<strong>{$lang.shop_price}</strong><font id=”ECS_SHOPPRICE”>{$goods.shop_price_formated}</font><br />
其实,基本的思路就是将这个if单分支结构改为if else双分支选择结构来实现。
ECshop模板引擎中的if单分支结构判断语句:
<!–{if 判断条件 }–>
……
…只响应符合这个条件的操作…
……
<!–{/if}–>
if else双分支选择结构判断语句:
<!–{if 判断条件 }–>
…条件为真时…
{else}
…否则怎样…
<!–{/if}–>
评论