【问题标题】:How to use blurprint theme script into bigcommerce stencil Framwork format?如何使用蓝图主题脚本转换成 bigcommerce 模板框架格式?
【发布时间】:2017-04-18 07:54:38
【问题描述】:

我的问题很简单。我只是想用下面的javascript代码转换成模板框架格式

<script type="text/javascript">
$(document).ready(function() {
var CartTotal = '%%GLOBAL_CartItemTotal%%';
var CustomerGroup = '%%GLOBAL_CustomerGroupName%%';
var CartTotal = CartTotal.replace('$','');
var CartTotal = CartTotal.replace(',','');
if(CartTotal >= 100.0) {
$('.CartTotalMessage').hide();
}
else {
if (CustomerGroup == "Wholesale") {
$('.ProceedToCheckout').hide();
$('.PayPalExpressCheckout').hide();
$('#CartHeader h2 img').hide();
$('.btn-secondary').hide();
$('a[title="Click here to proceed to checkout"]').hide();
}
else {
$('.CartTotalMessage').hide();
}
}
});
</script>

它不适用于模板格式我知道需要使用模板大的对象。格式我已将 %%GLOBAL_CartItemTotal%% 替换为 {{cart.grand_total}} 并将 %%GLOBAL_CustomerGroupName%% 替换为 {{customer.customer_group_name}} 但在订单超过 100 美元之前它无法隐藏结帐按钮 我需要你的帮助实现这一目标。

【问题讨论】:

  • 看起来您需要找到包含购物车总数的页面元素,并使用它来设置变量而不是全局变量。对于客户组,您可以使用 {{customer.customer_group_name}} 或 {{customer.customer_group_id}}

标签: javascript bigcommerce stencils


【解决方案1】:

是的,我已经解决了我的问题,像这样转换上面的 js

<script type="text/javascript">
$(document).ready(function() {
var CartTotal = '{{cart.grand_total.formatted}}';
var CartTotal = CartTotal.replace('$','');
var CartTotal = CartTotal.replace(',','');
console.log(CartTotal);
if(CartTotal >= 100.0) {
   $('.CartTotalMessage').hide();
}
else {
  $('.CartTotalMessage').show();
  $('.PayPalExpressCheckout').hide();
  $('#CartHeader h2 img').hide();
  $('.btn-secondary').hide();
  $('a[title="Click here to proceed to checkout"]').hide();
}
});

感谢您的帮助

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-06-17
    • 1970-01-01
    • 2019-03-11
    • 1970-01-01
    相关资源
    最近更新 更多