From 58de916f79b3a6ad9867b57577d8632b159153eb Mon Sep 17 00:00:00 2001 From: gRoussac Date: Wed, 20 Mar 2013 20:10:52 +0100 Subject: [PATCH] [-] FO : Fix bug #PSCFV-8031 and maybe others, do not loop when calling displayNewProducts in blockcart --- modules/blockcart/ajax-cart.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/modules/blockcart/ajax-cart.js b/modules/blockcart/ajax-cart.js index 307bc301c..2eb44e093 100644 --- a/modules/blockcart/ajax-cart.js +++ b/modules/blockcart/ajax-cart.js @@ -427,6 +427,7 @@ var ajaxCart = { if (this.id != undefined) { //create a container for listing the products and hide the 'no product in the cart' message (only if the cart was empty) + if ($('#cart_block dl.products').length == 0) { $('#cart_block_no_products').before('
'); @@ -434,9 +435,8 @@ var ajaxCart = { } //if product is not in the displayed cart, add a new product's line var domIdProduct = this.id + '_' + (this.idCombination ? this.idCombination : '0') + '_' + (this.idAddressDelivery ? this.idAddressDelivery : '0'); - var domIdProductAttribute = this.id + '_' + (this.idCombination ? this.idCombination : '0'); - if ($('#cart_block_product_'+ domIdProduct ).length == 0) + if ($('#cart_block_product_'+ domIdProduct).length == 0) { var productId = parseInt(this.id); var productAttributeId = (this.hasAttributes ? parseInt(this.attributes) : 0); @@ -463,10 +463,9 @@ var ajaxCart = { //else update the product's line else { - var jsonProduct = this; - if($.trim($('#cart_block_product_' + domIdProduct + ' .quantity').text()) != jsonProduct.quantity || $.trim($('dt#cart_block_product_' + domIdProduct + ' .price').text()) != jsonProduct.priceByLine) + var jsonProduct = this; + if($.trim($('#cart_block_product_' + domIdProduct + ' .quantity').html()) != jsonProduct.quantity || $.trim($('#cart_block_product_' + domIdProduct + ' .price').html()) != jsonProduct.priceByLine) { - // Usual product if (!this.is_gift) $('#cart_block_product_' + domIdProduct + ' .price').text(jsonProduct.priceByLine);