// Fix bug with cart product price reload on changing delivery address

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@15904 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
mDeflotte
2012-06-07 09:12:28 +00:00
parent d7e4fcde55
commit 955fb96d0e
4 changed files with 35 additions and 4 deletions
+1 -3
View File
@@ -543,9 +543,7 @@ function updateCartSummary(json)
initial_price_text = '<span style="text-decoration:line-through;">'+initial_price+'</span><br />';
}
key_for_blockcart = json.products[i].id_product+'_'+json.products[i].id_product_attribute;
if (json.products[i].id_product_attribute == 0)
key_for_blockcart = json.products[i].id_product;
key_for_blockcart = json.products[i].id_product+'_'+json.products[i].id_product_attribute+'_'+json.products[i].id_address_delivery;
$('#cart_block_product_'+key_for_blockcart+' span.quantity').html(json.products[i].cart_quantity);
+32
View File
@@ -73,6 +73,38 @@ function updateAddressSelection()
}
else
{
// Update all product keys with the new address id
$('#cart_summary .address_'+deliveryAddress).each(function() {
$(this)
.removeClass('address_'+deliveryAddress)
.addClass('address_'+idAddress_delivery);
if ($(this).find('.cart_unit span').length > 0 && $(this).find('.cart_unit span').attr('id').length > 0)
$(this).find('.cart_unit span').attr('id', $(this).find('.cart_unit span').attr('id').replace(/_\d+$/, '_'+idAddress_delivery));
if ($(this).find('.cart_total span').length > 0 && $(this).find('.cart_total span').attr('id').length > 0)
$(this).find('.cart_total span').attr('id', $(this).find('.cart_total span').attr('id').replace(/_\d+$/, '_'+idAddress_delivery));
if ($(this).find('.cart_quantity_input').length > 0 && $(this).find('.cart_quantity_input').attr('name').length > 0)
{
name = $(this).find('.cart_quantity_input').attr('name')+'_hidden';
$(this).find('.cart_quantity_input').attr('name', $(this).find('.cart_quantity_input').attr('name').replace(/_\d+$/, '_'+idAddress_delivery));
if ($(this).find('[name='+name+']')> 0)
$(this).find('[name='+name+']').attr('name', name.replace(/_\d+_hidden$/, '_'+idAddress_delivery+'_hidden'));
}
if ($(this).find('.cart_quantity_delete').length > 0 && $(this).find('.cart_quantity_delete').attr('id').length > 0) {
$(this).find('.cart_quantity_delete')
.attr('id', $(this).find('.cart_quantity_delete').attr('id').replace(/_\d+$/, '_'+idAddress_delivery))
.attr('href', $(this).find('.cart_quantity_delete').attr('href').replace(/id_address_delivery=\d+&/, 'id_address_delivery='+idAddress_delivery+'&'))
}
});
// Update global var deliveryAddress
deliveryAddress = idAddress_delivery;
updateCarrierList(jsonData.carrier_data);
updatePaymentMethods(jsonData);
updateCartSummary(jsonData.summary);
@@ -24,7 +24,7 @@
* International Registered Trademark & Property of PrestaShop SA
*}
<tr id="product_{$product.id_product}_{$product.id_product_attribute}_0_{$product.id_address_delivery|intval}{if !empty($product.gift)}_gift{/if}" class="{if isset($productLast) && $productLast && (!isset($ignoreProductLast) || !$ignoreProductLast)}last_item{elseif isset($productFirst) && $productFirst}first_item{/if} {if isset($customizedDatas.$productId.$productAttributeId) AND $quantityDisplayed == 0}alternate_item{/if} cart_item {if $odd}odd{else}even{/if}">
<tr id="product_{$product.id_product}_{$product.id_product_attribute}_0_{$product.id_address_delivery|intval}{if !empty($product.gift)}_gift{/if}" class="{if isset($productLast) && $productLast && (!isset($ignoreProductLast) || !$ignoreProductLast)}last_item{elseif isset($productFirst) && $productFirst}first_item{/if} {if isset($customizedDatas.$productId.$productAttributeId) AND $quantityDisplayed == 0}alternate_item{/if} cart_item address_{$product.id_address_delivery|intval} {if $odd}odd{else}even{/if}">
<td class="cart_product">
<a href="{$link->getProductLink($product.id_product, $product.link_rewrite, $product.category)|escape:'htmlall':'UTF-8'}"><img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'small')}" alt="{$product.name|escape:'htmlall':'UTF-8'}" {if isset($smallSize)}width="{$smallSize.width}" height="{$smallSize.height}" {/if} /></a>
</td>
+1
View File
@@ -51,6 +51,7 @@
var currencyBlank = '{$currencyBlank|intval}';
var txtProduct = "{l s='product'}";
var txtProducts = "{l s='products'}";
var deliveryAddress = {$cart->id_address_delivery|intval};
// ]]>
</script>
<p style="display:none" id="emptyCartWarning" class="warning">{l s='Your shopping cart is empty.'}</p>