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条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 python忆阻器数字识别
    • ¥15 无法输出helloworld
    • ¥15 高通uboot 打印ubi init err 22
    • ¥20 PDF元数据中的XMP媒体管理属性
    • ¥15 R语言中lasso回归报错
    • ¥15 网站突然不能访问了,上午还好好的
    • ¥15 有没有dl可以帮弄”我去图书馆”秒选道具和积分
    • ¥15 semrush,SEO,内嵌网站,api
    • ¥15 Stata:为什么reghdfe后的因变量没有被发现识别啊
    • ¥15 振荡电路,ADS仿真