Fix product deletion in cart with configurator

This commit is contained in:
Michael RICOIS 2017-08-29 17:51:42 +02:00
parent 0fa18ba339
commit 3b08c71f6a
2 changed files with 13 additions and 4 deletions

View File

@ -502,12 +502,11 @@ class Cart extends CartCore
SET `quantity` = '.(int)$result['quantity'].'
WHERE `id_cart` = '.(int)$this->id.'
AND `id_product` = '.(int)$id_product.
($id_configurator != null ? ' AND `id_configurator` = '.(int)$id_configurator : '').
($id_configurator !== null ? ' AND `id_configurator` = '.(int)$id_configurator : '').
($id_product_attribute != null ? ' AND `id_product_attribute` = '.(int)$id_product_attribute : '')
);
}
$result = Db::getInstance()->execute('
DELETE FROM `'._DB_PREFIX_.'cart_product`
WHERE `id_product` = '.(int)$id_product.

View File

@ -40,7 +40,11 @@ $(document).ready(function(){
url: baseUri + '?rand=' + new Date().getTime(),
async: true,
cache: false,
data: 'controller=cart&ajax=true&allowSeperatedPackage=true&value='
dataType: 'json',
data: 'controller=cart&ajax=true'
+ '&summary=true'
+ '&allowSeperatedPackage=true'
+ '&value='
+ ($(this).prop('checked') ? '1' : '0')
+ '&token='+static_token
+ '&allow_refresh=1',
@ -353,6 +357,8 @@ function deleteProductFromSummary(id)
customizationId = parseInt(ids[2]);
if (typeof(ids[3]) !== 'undefined')
id_address_delivery = parseInt(ids[3]);
if (typeof(ids[4]) !== 'undefined')
id_configurator = parseInt(ids[4]);
$.ajax({
type: 'POST',
headers: { "cache-control": "no-cache" },
@ -366,6 +372,7 @@ function deleteProductFromSummary(id)
+ '&ipa='+productAttributeId
+ '&id_address_delivery='+id_address_delivery
+ ((customizationId !== 0) ? '&id_customization=' + customizationId : '')
+ '&id_configurator='+id_configurator
+ '&token=' + static_token
+ '&allow_refresh=1',
success: function(jsonData)
@ -748,7 +755,7 @@ function updateCartSummary(json)
var reduction_type = product_list[i].reduction_type;
var reduction_symbol = '';
var initial_price_text = '';
initial_price = '';
var initial_price = '';
if (typeof(product_list[i].price_without_quantity_discount) !== 'undefined')
initial_price = formatCurrency(product_list[i].price_without_quantity_discount, currencyFormat, currencySign, currencyBlank);
@ -850,7 +857,10 @@ function updateCartSummary(json)
else
{
if ($('.cart_discount').length == 0)
{
location.reload();
return;
}
if (priceDisplayMethod !== 0)
$('#total_discount').html('-' + formatCurrency(json.total_discounts_tax_exc, currencyFormat, currencySign, currencyBlank));