diff --git a/admin-dev/themes/default/template/controllers/orders/form.tpl b/admin-dev/themes/default/template/controllers/orders/form.tpl index 6f2d4e35e..f0faa314c 100755 --- a/admin-dev/themes/default/template/controllers/orders/form.tpl +++ b/admin-dev/themes/default/template/controllers/orders/form.tpl @@ -38,6 +38,7 @@ var txt_hide_carts = '{l s='Hide carts and orders for this customer'}'; var defaults_order_state = new Array(); var customization_errors = false; + var pic_dir = '{$pic_dir}'; {foreach from=$defaults_order_state key='module' item='id_order_state'} defaults_order_state['{$module}'] = '{$id_order_state}'; {/foreach} @@ -639,16 +640,44 @@ } } - function updateCartProducts(products, gifts) + function updateCartProducts(products, gifts, id_address_delivery) { var cart_content = ''; $.each(products, function() { + var id_product = Number(this.id_product); + var id_product_attribute = Number(this.id_product_attribute); cart_quantity[Number(this.id_product)+'_'+Number(this.id_product_attribute)+'_'+Number(this.id_customization)] = this.cart_quantity; cart_content += ''+this.name+'
'+this.attributes_small+''+this.reference+' '; - cart_content += '

'; - cart_content += '
'; - cart_content += ''; - cart_content += '
'+this.total+' '; + cart_content += (!this.id_customization ? '

' : ''); + cart_content += (!this.id_customization ? '
' : ''); + cart_content += (!this.id_customization ? '
' : ''); + cart_content += ''+this.total+' '; + if (this.id_customization) + { + $.each(this.customized_datas[this.id_product][this.id_product_attribute][id_address_delivery], function() { + var customized_desc = ''; + if(this.datas[1].length) + { + $.each(this.datas[1],function() { + customized_desc += this.name+':'+this.value+'
'; + id_customization = this.id_customization; + }); + } + if(this.datas[0] && this.datas[0].length) + { + $.each(this.datas[0],function() { + customized_desc += this.name+':
'; + id_customization = this.id_customization; + }); + } + console.log(cart_content); + cart_content += ''+customized_desc+''; + cart_content += '

'; + cart_content += '
'; + cart_content += ''; + cart_content += '
'; + }); + } }); $.each(gifts, function() { cart_content += ''+this.name+'
'+this.attributes_small+''+this.reference+''; @@ -680,7 +709,7 @@ function displaySummary(jsonSummary) { - updateCartProducts(jsonSummary.summary.products, jsonSummary.summary.gift_products); + updateCartProducts(jsonSummary.summary.products, jsonSummary.summary.gift_products, jsonSummary.cart.id_address_delivery); updateCartVouchers(jsonSummary.summary.discounts); updateAddressesList(jsonSummary.addresses, jsonSummary.cart.id_address_delivery, jsonSummary.cart.id_address_invoice); diff --git a/classes/Cart.php b/classes/Cart.php index cf0f18b93..a357d81db 100644 --- a/classes/Cart.php +++ b/classes/Cart.php @@ -1165,7 +1165,7 @@ class CartCore extends ObjectModel // refresh cache of self::_products $this->_products = $this->getProducts(true); - return ($customization_quantity == $product_total_quantity && $this->deleteProduct((int)$id_product, $id_product_attribute, $id_address_delivery)); + return ($this->deleteProduct((int)$id_product, $id_product_attribute, $id_address_delivery) && $customization_quantity == $product_total_quantity); } /* Get customization quantity */ diff --git a/controllers/admin/AdminCartsController.php b/controllers/admin/AdminCartsController.php index bc4325f04..1b65a193a 100755 --- a/controllers/admin/AdminCartsController.php +++ b/controllers/admin/AdminCartsController.php @@ -539,6 +539,7 @@ class AdminCartsControllerCore extends AdminController $product['image_link'] = $this->context->link->getImageLink($product['link_rewrite'], $product['id_image'], 'small'); if (!isset($product['attributes_small'])) $product['attributes_small'] = ''; + $product['customized_datas'] = Product::getAllCustomizedDatas((int)$this->context->cart->id, null, true); } if (count($summary['discounts'])) foreach ($summary['discounts'] as &$voucher)