weixin_33725239 2017-09-11 15:51 采纳率: 0%
浏览 55

图层购物车叠加错误

After update from 1.6.1.2 to 1.6.1.16 without updating the theme. When I'm adding product to the cart .layer_cart_overlay does not show anymore. So now, that modal popup window doesn't appear, Chrome devtool said chrome error and Firefox devtool said: 

TypeError: product.attributes_full is undefined

So, is it enough to add if (typeof product.attributes_full !== 'undefined')?

My code, lines 732-748:

    updateLayer : function(product){
    $('#layer_cart_product_title').text(product.name);
    $('#layer_cart_product_attributes').text('');
    if (product.hasAttributes && product.hasAttributes == true)
        $('#layer_cart_product_attributes').html(product.attributes_full.replace(/\,/g,'<br>'));
    $('#layer_cart_product_price').text(product.price);
    $('#layer_cart_product_quantity').text(product.quantity);
    $('.layer_cart_img').html('<img class="layer_cart_img img-responsive" src="' + product.image + '" alt="' + product.name + '" title="' + product.name + '" />');

    var n = parseInt($(window).scrollTop()) + 'px';

    $('.layer_cart_overlay').css('width','100%');
    $('.layer_cart_overlay').css('height','100%');
    $('.layer_cart_overlay').show();
    $('#layer_cart').css({'top': n}).fadeIn('fast');
    crossselling_serialScroll();
},

Lines 346-354:

if (idCombination)
  $(jsonData.products).each(function() {
    if (this.id != undefined
      && this.id == parseInt(idProduct)
      && this.idCombination == parseInt(idCombination)
    )
      if (contentOnly)
        window.parent.ajaxCart.updateLayer(this);
      else
        ajaxCart.updateLayer(this);
  });

Link to full project: ajax-cart.js

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 matlab图像高斯低通滤波
    • ¥15 针对曲面部件的制孔路径规划,大家有什么思路吗
    • ¥15 钢筋实图交点识别,机器视觉代码
    • ¥15 如何在Linux系统中,但是在window系统上idea里面可以正常运行?(相关搜索:jar包)
    • ¥50 400g qsfp 光模块iphy方案
    • ¥15 两块ADC0804用proteus仿真时,出现异常
    • ¥15 关于风控系统,如何去选择
    • ¥15 这款软件是什么?需要能满足我的需求
    • ¥15 SpringSecurityOauth2登陆前后request不一致
    • ¥15 禅道二次开发编辑版本,上传不了发行包