【问题标题】:Magento checkout jquery function null errorMagento结帐jquery函数空错误
【发布时间】:2017-07-12 07:35:11
【问题描述】:

我收到错误 TypeError: $(...) is null 并且 TypeError: $(...).visible 为 null。

在单页结帐 jquery 函数中是 if($('checkout-step-shipping').visible() || $('checkout-step-shipping_method').visible())

请告诉我可能导致此问题的原因

function styleRegionInterval() {
    if (!intervalInit) {
        styleRegion = setInterval(styleRegionInput, 500);
        intervalInit = true;
    }
}
function styleRegionInput() {
    if($('checkout-step-shipping').visible() || $('checkout-step-shipping_method').visible()) {
        clearInterval(styleRegion);
        intervalInit = false;
        shippingRegionUpdater.update();
    }
}

几天前我删除了送货方式,但没有它我的结帐工作正常。

结算或注册页面上的结帐以继续按钮与那里的函数调用相同。

【问题讨论】:

  • 这是 jQuery 还是 Prototype? (看起来像原型)。
  • Magento1 还是 Magento2?
  • 因为我在结帐时跳过了送货方式。我必须删除 checkout-shipping-method.visible() 条件,因为它不是 onepage 的一部分。这解决了我的问题。我的 magento 版本 1.9.1.1

标签: magento magento-1.7 magento-1.9 magento2 magento-1.8


【解决方案1】:

尝试使用 jQuery('checkout-step-shipping').visible() 而不是 $('checkout-step-shipping').visible()。

你的罐头应该是这样的:

function styleRegionInterval() {
    if (!intervalInit) {
        styleRegion = setInterval(styleRegionInput, 500);
        intervalInit = true;
    }
}
function styleRegionInput() {
    if(jQuery('checkout-step-shipping').visible() || jQuery('checkout-step-shipping_method').visible()) {
        clearInterval(styleRegion);
        intervalInit = false;
        shippingRegionUpdater.update();
    }
}

【讨论】:

  • 另外,jQuery 选择器似乎是错误的:checkout-step-shipping 应该是 .checkout-step-shipping 而 .visible() 应该是 .is(':visible')
  • tnx 用于响应。我的问题解决了,因为 o 已跳过结帐,我刚刚删除了 step-shipping-method.visible() frm 条件。
猜你喜欢
  • 2012-02-06
  • 1970-01-01
  • 1970-01-01
  • 2010-12-02
  • 2014-11-17
  • 1970-01-01
  • 2013-08-03
  • 2013-08-01
  • 1970-01-01
相关资源
最近更新 更多