0

由于将 Magento 网站从 1.8 升级到 1.9 并将它们切换到 RWD 主题,因此在为捆绑产品选择产品选项时价格不会更新。

当您选择一个选项时,控制台会返回以下错误:-

未捕获的类型错误:无法读取 null 的属性“更新”

这发生在第 83 行,bundle.js其中是tierPriceElement.update(tierPriceHtml);

这是整个changeSelection方法的一部分,包括在下面:-

changeSelection: function(selection){
    var parts = selection.id.split('-');
    if (this.config['options'][parts[2]].isMulti) {
        selected = new Array();
        if (selection.tagName == 'SELECT') {
            for (var i = 0; i < selection.options.length; i++) {
                if (selection.options[i].selected && selection.options[i].value != '') {
                    selected.push(selection.options[i].value);
                }
            }
        } else if (selection.tagName == 'INPUT') {
            selector = parts[0]+'-'+parts[1]+'-'+parts[2];
            selections = $$('.'+selector);
            for (var i = 0; i < selections.length; i++) {
                if (selections[i].checked && selections[i].value != '') {
                    selected.push(selections[i].value);
                }
            }
        }
        this.config.selected[parts[2]] = selected;
    } else {
        if (selection.value != '') {
            this.config.selected[parts[2]] = new Array(selection.value);
        } else {
            this.config.selected[parts[2]] = new Array();
        }
        this.populateQty(parts[2], selection.value);
        var tierPriceElement = $('bundle-option-' + parts[2] + '-tier-prices'),
            tierPriceHtml = '';
        if (selection.value != '' && this.config.options[parts[2]].selections[selection.value].customQty == 1) {
            tierPriceHtml = this.config.options[parts[2]].selections[selection.value].tierPriceHtml;
        }
        tierPriceElement.update(tierPriceHtml);
    }
    this.reloadPrice();
},

我可以看到这里曾经存在完全相同的问题,但它已被删除。

鉴于这是与 Magento 1.9 打包的代码,奇怪的是它没有按预期工作......我确实强制主题回退到主题的模板文件,base并且在尝试更改时触发了相同的错误捆绑产品上的选项。

JavaScript 当然不是我的专长(也不是调试它),上面的代码片段有什么不对吗?或者关于如何找到原因的任何建议?

编辑

看来它毕竟是主题中的东西,因为我恢复到默认的 RWD 主题并且价格正在更新 - 可能是扩展名或布局 XML 中调用的其他东西。

4

3 回答 3

0

迁移到企业版后,我遇到了同样的问题。在我的情况下,解决方案与您的解决方案类似:重命名或删除文件app/design/frontend/MYPACKAGE/MYTHEME/template/bundle/catalog/product/view/type/bundle/option夹中的文件,以便系统回退到base/default/文件。

于 2014-11-18T14:05:08.297 回答
0

我在包默认主题覆盖和从 Magento 1.8 升级到 1.9 升级时遇到了类似的问题:

app/design/frontend/{package}/default/template/bundle/catalog/product/view/type/bundle/option/

诀窍只是删除它,或者我可以复制下来 rwd/default/../option 并保留可能需要的基本主题的类或 HTML。

于 2015-04-06T17:40:48.967 回答
0

最终,通过大量的试验和错误,我确定了这个问题,毕竟确实是由 3rd 方扩展引起的。

这个罪魁祸首扩展是Iceberg Commerce 的 Magento 产品选项灯箱,以帮助可能遇到这种情况的其他人。

这个扩展catalog/product/view/type/bundle/option/radio.phtml用它自己的版本覆盖。它是使用过时代码的自己的版本(尽管扩展声称与 Magento 1.9 兼容,但实际上它使用的是早期版本的捆绑选项代码。

修复(对于那些希望使用此扩展程序的人):-

替换此文件的全部内容 ( iceberg/bundledoptiondetails/catalog/product/view/type/bundle/option/radio.phtml):-

使用我的 pastebin 中的这个版本

于 2014-09-05T11:00:00.457 回答