Prestashop:tpl 文件中的条件语句问题(PHP,Smarty)
Prestashop: issue with conditional statements in tpl file (PHP, Smarty)
我正在努力实现这个目标:
- 在订单确认页面显示条件凭证。
- 凭证与两个必要条件相关:订单的
权重以及用户是否有帐户
所以我正在处理以下文件:/public_html/themes/mytheme/templates/checkout/order-confirmation.tpl。到目前为止我已经试过了:
{if ($order.shipping_weight >= 1.00) && ($logged)}
<div class="5-percent-voucher">Voucher</div>
{elseif ($order.shipping_weight >= 2.00) && ($logged)}
<div class="10-percent-voucher">Voucher</div>
{else}
{/if}
好消息是页面没有崩溃。坏消息是,当我模拟满足条件的结账时,什么也没有显示。
有谁知道我在这里做错了什么?非常感谢
因为在1.7中你没有$logged
,你需要使用$customer.is_logged
:)
我正在努力实现这个目标:
- 在订单确认页面显示条件凭证。
- 凭证与两个必要条件相关:订单的 权重以及用户是否有帐户
所以我正在处理以下文件:/public_html/themes/mytheme/templates/checkout/order-confirmation.tpl。到目前为止我已经试过了:
{if ($order.shipping_weight >= 1.00) && ($logged)}
<div class="5-percent-voucher">Voucher</div>
{elseif ($order.shipping_weight >= 2.00) && ($logged)}
<div class="10-percent-voucher">Voucher</div>
{else}
{/if}
好消息是页面没有崩溃。坏消息是,当我模拟满足条件的结账时,什么也没有显示。
有谁知道我在这里做错了什么?非常感谢
因为在1.7中你没有$logged
,你需要使用$customer.is_logged
:)