diff --git a/admin-dev/themes/default/template/controllers/orders/form.tpl b/admin-dev/themes/default/template/controllers/orders/form.tpl index da9b1f587..ade046406 100755 --- a/admin-dev/themes/default/template/controllers/orders/form.tpl +++ b/admin-dev/themes/default/template/controllers/orders/form.tpl @@ -29,6 +29,7 @@ var changed_shipping_price = false; var shipping_price_selected_carrier = ''; var current_index = '{$current}&token={$token}'; + var admin_cart_link = '{$link->getAdminLink('AdminCarts')}'; var cart_quantity = new Array(); var currencies = new Array(); var id_currency = ''; @@ -36,6 +37,7 @@ var txt_show_carts = '{l s='Show carts and orders for this customer'}'; var txt_hide_carts = '{l s='Hide carts and orders for this customer'}'; var defaults_order_state = new Array(); + var customization_errors = false; {foreach from=$defaults_order_state key='module' item='id_order_state'} defaults_order_state['{$module}'] = '{$id_order_state}'; {/foreach} @@ -524,33 +526,55 @@ { var products_found = ''; var attributes_html = ''; + var customization_html = ''; stock = {}; if(res.found) { $('#products_err').hide(); $('#products_found').show(); - products_found += '
'; + }); + customization_html += ''; + } $.each(this.combinations, function() { attributes_html += ''; }); stock[this.id_product] = this.stock; - + attributes_html += ''; }); - products_found += ''; - $('#products_found #product_list').html(products_found); $('#products_found #attributes_list').html(attributes_html); - displayProductAttributes(); + $('#products_found #customization_list').contents().find('body').html(customization_html); + display_product_attributes(); + display_product_customizations(); $('#id_product').change(); } else @@ -563,8 +587,21 @@ } }); } - - function displayProductAttributes() + + function display_product_customizations() + { + if ($('#products_found #customization_list').contents().find('#customization_'+$('#id_product option:selected').val()).children().length === 0) + $('#customization_list').hide(); + else + { + $('#customization_list').show(); + $('#products_found #customization_list').contents().find('.id_customization').hide(); + $('#products_found #customization_list').contents().find('#customization_'+$('#id_product option:selected').val()).show(); + $('#products_found #customization_list').css('height',$('#products_found #customization_list').contents().find('#customization_'+$('#id_product option:selected').val()).height()+95+'px'); + } + } + + function display_product_attributes() { if ($('#ipa_'+$('#id_product option:selected').val()+' option').length === 0) $('#attributes_list').hide(); @@ -672,7 +709,7 @@ id_product_attribute: id_product_attribute, qty: qty, id_customer: id_customer, - id_cart: id_cart + id_cart: id_cart, }, success : function(res) { @@ -701,7 +738,14 @@ function addProduct() { var id_product = $('#id_product option:selected').val(); - updateQty(id_product, $('#ipa_'+id_product+' option:selected').val(), $('#qty').val()); + $('#products_found #customization_list').contents().find('#customization_'+id_product).submit(); + if (customization_errors) + $('#products_err').show(); + else + { + $('#products_err').hide(); + updateQty(id_product, $('#ipa_'+id_product+' option:selected').val(), $('#qty').val()); + } } function updateCurrency() @@ -883,6 +927,19 @@{l s='In stock:'}