Fix product deletion in cart with configurator
This commit is contained in:
parent
0fa18ba339
commit
3b08c71f6a
@ -502,12 +502,11 @@ class Cart extends CartCore
|
|||||||
SET `quantity` = '.(int)$result['quantity'].'
|
SET `quantity` = '.(int)$result['quantity'].'
|
||||||
WHERE `id_cart` = '.(int)$this->id.'
|
WHERE `id_cart` = '.(int)$this->id.'
|
||||||
AND `id_product` = '.(int)$id_product.
|
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 : '')
|
($id_product_attribute != null ? ' AND `id_product_attribute` = '.(int)$id_product_attribute : '')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$result = Db::getInstance()->execute('
|
$result = Db::getInstance()->execute('
|
||||||
DELETE FROM `'._DB_PREFIX_.'cart_product`
|
DELETE FROM `'._DB_PREFIX_.'cart_product`
|
||||||
WHERE `id_product` = '.(int)$id_product.
|
WHERE `id_product` = '.(int)$id_product.
|
||||||
|
@ -40,7 +40,11 @@ $(document).ready(function(){
|
|||||||
url: baseUri + '?rand=' + new Date().getTime(),
|
url: baseUri + '?rand=' + new Date().getTime(),
|
||||||
async: true,
|
async: true,
|
||||||
cache: false,
|
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')
|
+ ($(this).prop('checked') ? '1' : '0')
|
||||||
+ '&token='+static_token
|
+ '&token='+static_token
|
||||||
+ '&allow_refresh=1',
|
+ '&allow_refresh=1',
|
||||||
@ -353,6 +357,8 @@ function deleteProductFromSummary(id)
|
|||||||
customizationId = parseInt(ids[2]);
|
customizationId = parseInt(ids[2]);
|
||||||
if (typeof(ids[3]) !== 'undefined')
|
if (typeof(ids[3]) !== 'undefined')
|
||||||
id_address_delivery = parseInt(ids[3]);
|
id_address_delivery = parseInt(ids[3]);
|
||||||
|
if (typeof(ids[4]) !== 'undefined')
|
||||||
|
id_configurator = parseInt(ids[4]);
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
headers: { "cache-control": "no-cache" },
|
headers: { "cache-control": "no-cache" },
|
||||||
@ -366,6 +372,7 @@ function deleteProductFromSummary(id)
|
|||||||
+ '&ipa='+productAttributeId
|
+ '&ipa='+productAttributeId
|
||||||
+ '&id_address_delivery='+id_address_delivery
|
+ '&id_address_delivery='+id_address_delivery
|
||||||
+ ((customizationId !== 0) ? '&id_customization=' + customizationId : '')
|
+ ((customizationId !== 0) ? '&id_customization=' + customizationId : '')
|
||||||
|
+ '&id_configurator='+id_configurator
|
||||||
+ '&token=' + static_token
|
+ '&token=' + static_token
|
||||||
+ '&allow_refresh=1',
|
+ '&allow_refresh=1',
|
||||||
success: function(jsonData)
|
success: function(jsonData)
|
||||||
@ -748,7 +755,7 @@ function updateCartSummary(json)
|
|||||||
var reduction_type = product_list[i].reduction_type;
|
var reduction_type = product_list[i].reduction_type;
|
||||||
var reduction_symbol = '';
|
var reduction_symbol = '';
|
||||||
var initial_price_text = '';
|
var initial_price_text = '';
|
||||||
initial_price = '';
|
var initial_price = '';
|
||||||
|
|
||||||
if (typeof(product_list[i].price_without_quantity_discount) !== 'undefined')
|
if (typeof(product_list[i].price_without_quantity_discount) !== 'undefined')
|
||||||
initial_price = formatCurrency(product_list[i].price_without_quantity_discount, currencyFormat, currencySign, currencyBlank);
|
initial_price = formatCurrency(product_list[i].price_without_quantity_discount, currencyFormat, currencySign, currencyBlank);
|
||||||
@ -850,7 +857,10 @@ function updateCartSummary(json)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ($('.cart_discount').length == 0)
|
if ($('.cart_discount').length == 0)
|
||||||
|
{
|
||||||
location.reload();
|
location.reload();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (priceDisplayMethod !== 0)
|
if (priceDisplayMethod !== 0)
|
||||||
$('#total_discount').html('-' + formatCurrency(json.total_discounts_tax_exc, currencyFormat, currencySign, currencyBlank));
|
$('#total_discount').html('-' + formatCurrency(json.total_discounts_tax_exc, currencyFormat, currencySign, currencyBlank));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user