diff --git a/classes/Cart.php b/classes/Cart.php
index f35eb4f47..95c4cb53f 100644
--- a/classes/Cart.php
+++ b/classes/Cart.php
@@ -858,7 +858,7 @@ class CartCore extends ObjectModel
CartRule::autoAddToCart($context);
if ($product->customizable)
- return $this->_updateCustomizationQuantity((int)$quantity, (int)$id_customization, (int)$id_product, (int)$id_product_attribute, $operator);
+ return $this->_updateCustomizationQuantity((int)$quantity, (int)$id_customization, (int)$id_product, (int)$id_product_attribute, (int)$id_address_delivery , $operator);
else
return true;
}
@@ -866,7 +866,7 @@ class CartCore extends ObjectModel
/*
** Customization management
*/
- protected function _updateCustomizationQuantity($quantity, $id_customization, $id_product, $id_product_attribute, $operator = 'up')
+ protected function _updateCustomizationQuantity($quantity, $id_customization, $id_product, $id_product_attribute, $id_address_delivery, $operator = 'up')
{
// Link customization to product combination when it is first added to cart
if (empty($id_customization))
@@ -880,6 +880,7 @@ class CartCore extends ObjectModel
UPDATE `'._DB_PREFIX_.'customization`
SET `quantity` = '.(int)$quantity.',
`id_product_attribute` = '.(int)$id_product_attribute.',
+ `id_address_delivery` = '.(int)$id_address_delivery.',
`in_cart` = 1
WHERE `id_customization` = '.(int)$field['id_customization']);
}
@@ -901,11 +902,17 @@ class CartCore extends ObjectModel
return Db::getInstance()->execute('
UPDATE `'._DB_PREFIX_.'customization`
- SET `quantity` = `quantity` '.($operator == 'up' ? '+ ' : '- ').(int)$quantity.'
+ SET
+ `quantity` = `quantity` '.($operator == 'up' ? '+ ' : '- ').(int)$quantity.',
+ `id_address_delivery` = '.(int)$id_address_delivery.'
WHERE `id_customization` = '.(int)$id_customization);
}
+ else
+ Db::getInstance()->execute('
+ UPDATE `'._DB_PREFIX_.'customization`
+ SET `id_address_delivery` = '.(int)$id_address_delivery.'
+ WHERE `id_customization` = '.(int)$id_customization);
}
-
// refresh cache of self::_products
$this->_products = $this->getProducts(true);
$this->update(true);
@@ -3010,6 +3017,13 @@ class CartCore extends ObjectModel
WHERE `id_cart` = '.(int)$this->id.'
AND (`id_address_delivery` = 0 OR `id_address_delivery` IS NULL)
AND `id_shop` = '.(int)$this->id_shop;
+
+ $sql = 'UPDATE `'._DB_PREFIX_.'customization`
+ SET `id_address_delivery` = '.(int)$id_address_delivery.'
+ WHERE `id_cart` = '.(int)$this->id.'
+ AND (`id_address_delivery` = 0 OR `id_address_delivery` IS NULL)
+ AND `id_shop` = '.(int)$this->id_shop;
+
Db::getInstance()->execute($sql);
}
diff --git a/classes/Tools.php b/classes/Tools.php
index 402e2ec5a..b9d422d61 100644
--- a/classes/Tools.php
+++ b/classes/Tools.php
@@ -2117,7 +2117,6 @@ FileETag INode MTime Size
foreach ($files as $file)
if (strpos($file, $real_ext) && strpos($file, $real_ext) == (strlen($file) - $real_ext_length))
$filtered_files[] = $dir . '/' . $file;
- //elog($filtered_files);
return $filtered_files;
}
}
diff --git a/modules/blockcart/ajax-cart.js b/modules/blockcart/ajax-cart.js
index b517d106a..e21a5f449 100644
--- a/modules/blockcart/ajax-cart.js
+++ b/modules/blockcart/ajax-cart.js
@@ -395,7 +395,8 @@ var ajaxCart = {
// Update product quantity
updateProductQuantity : function (product, quantity) {
- $('dt#cart_block_product_' + product.id + (product.idCombination ? '_' + product.idCombination : '') + ' .quantity').fadeTo('fast', 0, function() {
+
+ $('dt#cart_block_product_' + product.id + '_' + (product.idCombination ? product.idCombination : '0')+ '_' + (product.idAddressDelivery ? product.idAddressDelivery : '0') + ' .quantity').fadeTo('fast', 0, function() {
$(this).text(quantity);
$(this).fadeTo('fast', 1, function(){
$(this).fadeTo('fast', 0, function(){
@@ -425,7 +426,8 @@ var ajaxCart = {
$('p#cart_block_no_products').hide();
}
//if product is not in the displayed cart, add a new product's line
- var domIdProduct = this.id + (this.idCombination ? '_' + this.idCombination : '');
+ 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 dt#cart_block_product_'+ domIdProduct ).length == 0)
{
@@ -511,7 +513,7 @@ var ajaxCart = {
$(this.datas).each(function(){
if (this['index'] == 0)
{
- content += this.truncatedValue.replace(/
/g, ' ');
+ content += ' ' + this.truncatedValue.replace(/
/g, ' ');
done = 1;
return false;
}
diff --git a/modules/blockcart/blockcart-json.tpl b/modules/blockcart/blockcart-json.tpl
index 7a1ecc6cd..0e77ce998 100644
--- a/modules/blockcart/blockcart-json.tpl
+++ b/modules/blockcart/blockcart-json.tpl
@@ -48,7 +48,7 @@
"hasCustomizedDatas": {if isset($customizedDatas.$productId.$productAttributeId)}true{else}false{/if},
"customizedDatas":[
- {if isset($customizedDatas.$productId.$productAttributeId)}
+ {if isset($customizedDatas.$productId.$productAttributeId[$product.id_address_delivery])}
{foreach from=$customizedDatas.$productId.$productAttributeId[$product.id_address_delivery] key='id_customization' item='customization' name='customizedDatas'}{ldelim}
{* This empty line was made in purpose (product addition debug), please leave it here *}
diff --git a/modules/blockcart/blockcart.css b/modules/blockcart/blockcart.css
index 6b7e2082b..412671513 100644
--- a/modules/blockcart/blockcart.css
+++ b/modules/blockcart/blockcart.css
@@ -1,19 +1,19 @@
/* Special style for block cart*/
#cart_block {
- z-index: 10;
+ z-index: 10;
display:none;
- position: absolute;
- right: 0;
- top: 65px;
- height: auto;
- width: 200px;
+ position: absolute;
+ right: 0;
+ top: 65px;
+ height: auto;
+ width: 200px;
-moz-border-radius-bottomright: 3px;
-moz-border-radius-bottomleft: 3px;
-webkit-border-radius-bottomright: 3px;
-webkit-border-radius-bottomleft: 3px;
border-bottom-right-radius: 3px;
border-bottom-left-radius: 3px;
- box-shadow: 0 1px 0 #C6C6C6;
+ box-shadow: 0 1px 0 #C6C6C6;
background:#eee
}
#cart_block.cart_block_hover {display:block}
@@ -24,11 +24,11 @@
}
#cart_block h4 span {
float: right;
- padding-left: 10px;
- text-transform: none;
- background-position: left top;
- background-repeat: no-repeat;
- cursor: pointer
+ padding-left: 10px;
+ text-transform: none;
+ background-position: left top;
+ background-repeat: no-repeat;
+ cursor: pointer
}
#cart_block h4 span#block_cart_collapse {background-image: url(img/icon/sort_asc_white.png) }
#cart_block h4 span#block_cart_expand {background-image: url(img/icon/sort_desc_white.png) }
@@ -65,7 +65,6 @@
#cart_block #cart_block_list dt {padding:4px 0}
#cart_block #cart_block_list dt a {font-weight:bold}
#cart_block #cart_block_list dd {
- display:none;
margin-left:20px
}
diff --git a/modules/blockcart/blockcart.tpl b/modules/blockcart/blockcart.tpl
index e02d1ccfd..cbf0c9c6b 100644
--- a/modules/blockcart/blockcart.tpl
+++ b/modules/blockcart/blockcart.tpl
@@ -69,16 +69,16 @@ var removingLinkText = '{l s='remove this product from my cart' mod='blockcart'
{if isset($product.attributes_small)}