【发布时间】:2021-07-27 22:45:09
【问题描述】:
我在 BigCommerce 中使用 Cornerstone 主题。在我的产品页面上,除非最终用户登录,否则我需要隐藏定价。 BigCommerce 具有此功能,但要么全有,要么全无,我只想限制某些商品显示其价格。我在名为 HidePrice 的产品级别使用自定义字段。此自定义字段为我网站上的每个产品定义了 True 或 False。我需要考虑三个条件...
- 最终用户已登录:无论 HidePrice 值为多少,都显示价格
- 产品的 HidePrice 值 = false:显示产品的价格
- 产品的 HidePrice 值 = true 且最终用户未登录:抑制产品价格并显示替代的“太低无法显示”消息。
这是我的代码不太好用...
<div class="productView-price">
{{#if customer}}
{{#if product.can_purchase}}
<p class="productView-price">
<span>Price: {{product.price.without_tax.value}}</span>
</p>
{{/if}}
{{else}}
{{#filter product.custom_fields 'HidePrice' property='name' }}
{{#if (toLowerCase value) '==' 'true'}}
<div class="too-low-to-show">This product is priced too low to show!</div>
{{else}}
<p class="productView-price">
<span>Price: {{product.price.without_tax.value}}</span>
</p>
{{/if}}
{{/filter}}
{{/if}}
</div>
我似乎无法工作的部分是上面的条件 #1(产品的 HidePrice 值 = false:显示产品的价格)。条件 #2 和 #3 工作得很好,但是当满足条件 #1 的要求时,价格根本不会显示。奇怪的是,我在价格车把显示之前预先添加了“价格:”标签,但价格车把本身似乎被 BigCommerce 忽略了。我发现如果我在条件语句之外使用相同的价格把手,它将呈现在页面上。我对这个感到困惑。任何帮助将不胜感激。谢谢!
【问题讨论】:
标签: bigcommerce