1{* 2* 2007-2016 PrestaShop 3* 4* NOTICE OF LICENSE 5* 6* This source file is subject to the Academic Free License (AFL 3.0) 7* that is bundled with this package in the file LICENSE.txt. 8* It is also available through the world-wide-web at this URL: 9* http://opensource.org/licenses/afl-3.0.php 10* If you did not receive a copy of the license and are unable to 11* obtain it through the world-wide-web, please send an email 12* to license@prestashop.com so we can send you a copy immediately. 13* 14* DISCLAIMER 15* 16* Do not edit or add to this file if you wish to upgrade PrestaShop to newer 17* versions in the future. If you wish to customize PrestaShop for your 18* needs please refer to http://www.prestashop.com for more information. 19* 20* @author PrestaShop SA <contact@prestashop.com> 21* @copyright 2007-2016 PrestaShop SA 22* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) 23* International Registered Trademark & Property of PrestaShop SA 24*} 25<script type="text/javascript"> 26 var id_cart = {$cart->id|intval}; 27 var id_customer = 0; 28 var admin_order_tab_link = "{$link->getAdminLink('AdminOrders')|addslashes}"; 29 var changed_shipping_price = false; 30 var shipping_price_selected_carrier = ''; 31 var current_index = '{$current|escape:'html':'UTF-8'}&token={$token|escape:'html':'UTF-8'}'; 32 var admin_cart_link = '{$link->getAdminLink('AdminCarts')|addslashes}'; 33 var cart_quantity = new Array(); 34 var currencies = new Array(); 35 var id_currency = ''; 36 var id_lang = ''; 37 //var txt_show_carts = '{l s='Show carts and orders for this customer.' js=1}'; 38 //var txt_hide_carts = '{l s='Hide carts and orders for this customer.' js=1}'; 39 var defaults_order_state = new Array(); 40 var customization_errors = false; 41 var pic_dir = '{$pic_dir}'; 42 var currency_format = 5; 43 var currency_sign = ''; 44 var currency_blank = false; 45 var priceDisplayPrecision = 0; {* Set in displaySummary(). *} 46 var priceDatabasePrecision = {$smarty.const._TB_PRICE_DATABASE_PRECISION_}; 47 48 {foreach from=$defaults_order_state key='module' item='id_order_state'} 49 defaults_order_state['{$module}'] = '{$id_order_state}'; 50 {/foreach} 51 $(document).ready(function() { 52 53 $('#customer').typeWatch({ 54 captureLength: 1, 55 highlight: true, 56 wait: 750, 57 callback: function(){ searchCustomers(); } 58 }); 59 $('#product').typeWatch({ 60 captureLength: 1, 61 highlight: true, 62 wait: 750, 63 callback: function(){ searchProducts(); } 64 }); 65 $('#payment_module_name').change(function() { 66 var id_order_state = defaults_order_state[this.value]; 67 if (typeof(id_order_state) == 'undefined') 68 id_order_state = defaults_order_state['other']; 69 $('#id_order_state').val(id_order_state); 70 }); 71 $("#id_address_delivery").change(function() { 72 updateAddresses(); 73 }); 74 $("#id_address_invoice").change(function() { 75 updateAddresses(); 76 }); 77 $('#id_currency').change(function() { 78 updateCurrency(); 79 }); 80 $('#id_lang').change(function(){ 81 updateLang(); 82 }); 83 $('#delivery_option,#carrier_recycled_package,#order_gift,#gift_message').change(function() { 84 updateDeliveryOption(); 85 }); 86 $('#shipping_price').change(function() { 87 if ($(this).val() != shipping_price_selected_carrier) 88 changed_shipping_price = true; 89 }); 90 91 $('#payment_module_name').change(); 92 $.ajaxSetup({ type:"post" }); 93 $("#voucher").autocomplete('{$link->getAdminLink('AdminCartRules')|addslashes}', { 94 minChars: 3, 95 max: 15, 96 width: 250, 97 selectFirst: false, 98 scroll: false, 99 dataType: "json", 100 formatItem: function(data, i, max, value, term) { 101 return value; 102 }, 103 parse: function(data) { 104 if (!data.found) 105 $('#vouchers_err').html('{l s='No voucher was found'}').show(); 106 else 107 $('#vouchers_err').hide(); 108 var mytab = new Array(); 109 for (var i = 0; i < data.vouchers.length; i++) 110 mytab[mytab.length] = { data: data.vouchers[i], value: data.vouchers[i].name + (data.vouchers[i].code.length > 0 ? ' - ' + data.vouchers[i].code : '')}; 111 return mytab; 112 }, 113 extraParams: { 114 ajax: "1", 115 token: "{getAdminToken tab='AdminCartRules'}", 116 tab: "AdminCartRules", 117 action: "searchCartRuleVouchers" 118 } 119 } 120 ) 121 .result(function(event, data, formatted) { 122 $('#voucher').val(data.name); 123 add_cart_rule(data.id_cart_rule); 124 }); 125 {if $cart->id} 126 setupCustomer({$cart->id_customer|intval}); 127 useCart('{$cart->id|intval}'); 128 {/if} 129 130 $('.delete_product').live('click', function(e) { 131 e.preventDefault(); 132 var to_delete = $(this).attr('rel').split('_'); 133 deleteProduct(to_delete[1], to_delete[2], to_delete[3]); 134 }); 135 $('.delete_discount').live('click', function(e) { 136 e.preventDefault(); 137 deleteVoucher($(this).attr('rel')); 138 }); 139 $('.use_cart').live('click', function(e) { 140 e.preventDefault(); 141 useCart($(this).attr('rel')); 142 return false; 143 }); 144 145 $('input:radio[name="free_shipping"]').on('change',function() { 146 var free_shipping = $('input[name=free_shipping]:checked').val(); 147 $.ajax({ 148 type:"POST", 149 url: "{$link->getAdminLink('AdminCarts')|addslashes}", 150 async: true, 151 dataType: "json", 152 data : { 153 ajax: "1", 154 token: "{getAdminToken tab='AdminCarts'}", 155 tab: "AdminCarts", 156 action: "updateFreeShipping", 157 id_cart: id_cart, 158 id_customer: id_customer, 159 'free_shipping': free_shipping 160 }, 161 success : function(res) 162 { 163 displaySummary(res); 164 } 165 }); 166 }); 167 168 $('.duplicate_order').live('click', function(e) { 169 e.preventDefault(); 170 duplicateOrder($(this).attr('rel')); 171 }); 172 $('.cart_quantity').live('change', function(e) { 173 e.preventDefault(); 174 if ($(this).val() != cart_quantity[$(this).attr('rel')]) 175 { 176 var product = $(this).attr('rel').split('_'); 177 updateQty(product[0], product[1], product[2], $(this).val() - cart_quantity[$(this).attr('rel')]); 178 } 179 }); 180 $('.increaseqty_product, .decreaseqty_product').live('click', function(e) { 181 e.preventDefault(); 182 var product = $(this).attr('rel').split('_'); 183 var sign = ''; 184 if ($(this).hasClass('decreaseqty_product')) 185 sign = '-'; 186 updateQty(product[0], product[1],product[2], sign+1); 187 }); 188 $('#id_product').live('keydown', function(e) { 189 $(this).click(); 190 return true; 191 }); 192 $('#id_product, .id_product_attribute').live('change', function(e) { 193 e.preventDefault(); 194 displayQtyInStock(this.id); 195 }); 196 $('#id_product, .id_product_attribute').live('keydown', function(e) { 197 $(this).change(); 198 return true; 199 }); 200 $('.product_unit_price').live('change', function(e) { 201 e.preventDefault(); 202 var product = $(this).attr('rel').split('_'); 203 updateProductPrice(product[0], product[1], $(this).val()); 204 }); 205 $('#order_message').live('change', function(e) { 206 e.preventDefault(); 207 $.ajax({ 208 type:"POST", 209 url: "{$link->getAdminLink('AdminCarts')|addslashes}", 210 async: true, 211 dataType: "json", 212 data : { 213 ajax: "1", 214 token: "{getAdminToken tab='AdminCarts'}", 215 tab: "AdminCarts", 216 action: "updateOrderMessage", 217 id_cart: id_cart, 218 id_customer: id_customer, 219 message: $(this).val() 220 }, 221 success : function(res) 222 { 223 displaySummary(res); 224 } 225 }); 226 }); 227 resetBind(); 228 229 $('#customer').focus(); 230 231 $('#submitAddProduct').on('click',function(){ 232 addProduct(); 233 }); 234 235 $('#product').bind('keypress', function(e) { 236 var code = (e.keyCode ? e.keyCode : e.which); 237 if(code == 13) 238 { 239 e.stopPropagation(); 240 e.preventDefault(); 241 if ($('#submitAddProduct').length) 242 addProduct(); 243 } 244 }); 245 246 $('#send_email_to_customer').on('click',function(){ 247 sendMailToCustomer(); 248 return false; 249 }); 250 251 $('#products_found').hide(); 252 $('#carts').hide(); 253 254 $('#customer_part').on('click','button.setup-customer',function(e){ 255 e.preventDefault(); 256 setupCustomer($(this).data('customer')); 257 $(this).removeClass('setup-customer').addClass('change-customer').html('<i class="icon-refresh"></i> {l s="Change"}').blur(); 258 $(this).closest('.customerCard').addClass('selected-customer'); 259 $('.selected-customer .panel-heading').prepend('<i class="icon-ok text-success"></i>'); 260 $('.customerCard').not('.selected-customer').remove(); 261 $('#search-customer-form-group').hide(); 262 var query = 'ajax=1&token='+token+'&action=changePaymentMethod&id_customer='+$(this).data('customer'); 263 $.ajax({ 264 type: 'POST', 265 url: admin_order_tab_link, 266 headers: { "cache-control": "no-cache" }, 267 cache: false, 268 dataType: 'json', 269 data : query, 270 success : function(data) { 271 if (data.result) 272 $('#payment_module_name').replaceWith(data.view) 273 } 274 }); 275 }); 276 277 $('#customer_part').on('click','button.change-customer',function(e){ 278 e.preventDefault(); 279 $('#search-customer-form-group').show(); 280 $(this).blur(); 281 }); 282 }); 283 284 function resetBind() 285 { 286 $('.fancybox').fancybox({ 287 'type': 'iframe', 288 'width': '90%', 289 'height': '90%', 290 }); 291 292 $('.fancybox_customer').fancybox({ 293 'type': 'iframe', 294 'width': '90%', 295 'height': '90%', 296 'afterClose' : function () { 297 searchCustomers(); 298 } 299 }); 300 /*$("#new_address").fancybox({ 301 onClosed: useCart(id_cart) 302 });*/ 303 } 304 305 function add_cart_rule(id_cart_rule) 306 { 307 $.ajax({ 308 type:"POST", 309 url: "{$link->getAdminLink('AdminCarts')|addslashes}", 310 async: true, 311 dataType: "json", 312 data : { 313 ajax: "1", 314 token: "{getAdminToken tab='AdminCarts'}", 315 tab: "AdminCarts", 316 action: "addVoucher", 317 id_cart_rule: id_cart_rule, 318 id_cart: id_cart, 319 id_customer: id_customer 320 }, 321 success : function(res) 322 { 323 displaySummary(res); 324 $('#voucher').val(''); 325 var errors = ''; 326 if (res.errors.length > 0) 327 { 328 $.each(res.errors, function() { 329 errors += this+'<br/>'; 330 }); 331 $('#vouchers_err').html(errors).show(); 332 } 333 else 334 $('#vouchers_err').hide(); 335 } 336 }); 337 } 338 339 function updateProductPrice(id_product, id_product_attribute, new_price) 340 { 341 $.ajax({ 342 type:"POST", 343 url: "{$link->getAdminLink('AdminCarts')|addslashes}", 344 async: true, 345 dataType: "json", 346 data : { 347 ajax: "1", 348 token: "{getAdminToken tab='AdminCarts'}", 349 tab: "AdminCarts", 350 action: "updateProductPrice", 351 id_cart: id_cart, 352 id_product: id_product, 353 id_product_attribute: id_product_attribute, 354 id_customer: id_customer, 355 price: new Number(new_price.replace(",",".")) 356 }, 357 success : function(res) 358 { 359 displaySummary(res); 360 } 361 }); 362 } 363 364 function displayQtyInStock(id) 365 { 366 var id_product = $('#id_product').val(); 367 if ($('#ipa_' + id_product + ' option').length) 368 var id_product_attribute = $('#ipa_' + id_product).val(); 369 else 370 var id_product_attribute = 0; 371 372 $('#qty_in_stock').html(stock[id_product][id_product_attribute]); 373 } 374 375 function duplicateOrder(id_order) 376 { 377 $.ajax({ 378 type:"POST", 379 url: "{$link->getAdminLink('AdminCarts')|addslashes}", 380 async: true, 381 dataType: "json", 382 data : { 383 ajax: "1", 384 token: "{getAdminToken tab='AdminCarts'}", 385 tab: "AdminCarts", 386 action: "duplicateOrder", 387 id_order: id_order, 388 id_customer: id_customer 389 }, 390 success : function(res) 391 { 392 id_cart = res.cart.id; 393 $('#id_cart').val(id_cart); 394 displaySummary(res); 395 } 396 }); 397 } 398 399 function useCart(id_new_cart) 400 { 401 id_cart = id_new_cart; 402 $('#id_cart').val(id_cart); 403 $('#id_cart').val(id_cart); 404 $.ajax({ 405 type:"POST", 406 url: "{$link->getAdminLink('AdminCarts')|addslashes}", 407 async: false, 408 dataType: "json", 409 data : { 410 ajax: "1", 411 token: "{getAdminToken tab='AdminCarts'}", 412 tab: "AdminCarts", 413 action: "getSummary", 414 id_cart: id_cart, 415 id_customer: id_customer 416 }, 417 success : function(res) 418 { 419 displaySummary(res); 420 } 421 }); 422 } 423 424 function getSummary() 425 { 426 useCart(id_cart); 427 } 428 429 function deleteVoucher(id_cart_rule) 430 { 431 $.ajax({ 432 type:"POST", 433 url: "{$link->getAdminLink('AdminCarts')|addslashes}", 434 async: true, 435 dataType: "json", 436 data : { 437 ajax: "1", 438 token: "{getAdminToken tab='AdminCarts'}", 439 tab: "AdminCarts", 440 action: "deleteVoucher", 441 id_cart_rule: id_cart_rule, 442 id_cart: id_cart, 443 id_customer: id_customer 444 }, 445 success : function(res) 446 { 447 displaySummary(res); 448 } 449 }); 450 } 451 452 function deleteProduct(id_product, id_product_attribute, id_customization) 453 { 454 $.ajax({ 455 type:"POST", 456 url: "{$link->getAdminLink('AdminCarts')|addslashes}", 457 async: true, 458 dataType: "json", 459 data : { 460 ajax: "1", 461 token: "{getAdminToken tab='AdminCarts'}", 462 tab: "AdminCarts", 463 action: "deleteProduct", 464 id_product: id_product, 465 id_product_attribute: id_product_attribute, 466 id_customization: id_customization, 467 id_cart: id_cart, 468 id_customer: id_customer 469 }, 470 success : function(res) 471 { 472 displaySummary(res); 473 } 474 }); 475 } 476 477 function searchCustomers() 478 { 479 $.ajax({ 480 type:"POST", 481 url : "{$link->getAdminLink('AdminCustomers')}", 482 async: true, 483 dataType: "json", 484 data : { 485 ajax: "1", 486 tab: "AdminCustomers", 487 action: "searchCustomers", 488 customer_search: $('#customer').val()}, 489 success : function(res) 490 { 491 if(res.found) 492 { 493 var html = ''; 494 $.each(res.customers, function() { 495 html += '<div class="customerCard col-lg-4">'; 496 html += '<div class="panel">'; 497 html += '<div class="panel-heading">'+this.firstname+' '+this.lastname; 498 html += '<span class="pull-right">#'+this.id_customer+'</span></div>'; 499 html += '<span>'+this.email+'</span><br/>'; 500 html += '<span class="text-muted">'+((this.birthday != '0000-00-00') ? this.birthday : '')+'</span><br/>'; 501 html += '<div class="panel-footer">'; 502 html += '<a href="{$link->getAdminLink('AdminCustomers')}&id_customer='+this.id_customer+'&viewcustomer&liteDisplaying=1" class="btn btn-default fancybox"><i class="icon-search"></i> {l s='Details'}</a>'; 503 html += '<button type="button" data-customer="'+this.id_customer+'" class="setup-customer btn btn-default pull-right"><i class="icon-arrow-right"></i> {l s='Choose'}</button>'; 504 html += '</div>'; 505 html += '</div>'; 506 html += '</div>'; 507 }); 508 } 509 else 510 html = '<div class="alert alert-warning">{l s='No customers found'}</div>'; 511 $('#customers').html(html); 512 resetBind(); 513 } 514 }); 515 } 516 517 518 function setupCustomer(idCustomer) 519 { 520 $('#carts').show(); 521 $('#products_part').show(); 522 $('#vouchers_part').show(); 523 $('#address_part').show(); 524 $('#carriers_part').show(); 525 $('#summary_part').show(); 526 var address_link = $('#new_address').attr('href'); 527 id_customer = idCustomer; 528 id_cart = 0; 529 $('#new_address').attr('href', address_link.replace(/id_customer=[0-9]+/, 'id_customer='+id_customer)); 530 $.ajax({ 531 type:"POST", 532 url : "{$link->getAdminLink('AdminCarts')|addslashes}", 533 async: false, 534 dataType: "json", 535 data : { 536 ajax: "1", 537 token: "{getAdminToken tab='AdminCarts'}", 538 tab: "AdminCarts", 539 action: "searchCarts", 540 id_customer: id_customer, 541 id_cart: id_cart 542 }, 543 success : function(res) 544 { 545 if(res.found) 546 { 547 var html_carts = ''; 548 var html_orders = ''; 549 $.each(res.carts, function() { 550 html_carts += '<tr>'; 551 html_carts += '<td>'+this.id_cart+'</td>'; 552 html_carts += '<td>'+this.date_add+'</td>'; 553 html_carts += '<td>'+this.total_price+'</td>'; 554 html_carts += '<td class="text-right">'; 555 html_carts += '<a title="{l s='View this cart'}" class="fancybox btn btn-default" href="index.php?tab=AdminCarts&id_cart='+this.id_cart+'&viewcart&token={getAdminToken tab='AdminCarts'}&liteDisplaying=1#"><i class="icon-search"></i> {l s="Details"}</a>'; 556 html_carts += ' <a href="#" title="{l s='Use this cart'}" class="use_cart btn btn-default" rel="'+this.id_cart+'"><i class="icon-arrow-right"></i> {l s="Use"}</a>'; 557 html_carts += '</td>'; 558 html_carts += '</tr>'; 559 }); 560 561 $.each(res.orders, function() { 562 html_orders += '<tr>'; 563 html_orders += '<td>'+this.id_order+'</td><td>'+this.date_add+'</td><td>'+(this.nb_products ? this.nb_products : '0')+'</td><td>'+this.total_paid_real+'</span></td><td>'+this.payment+'</td><td>'+this.order_state+'</td>'; 564 html_orders += '<td class="text-right">'; 565 html_orders += '<a href="{$link->getAdminLink('AdminOrders')}&id_order='+this.id_order+'&vieworder&liteDisplaying=1#" title="{l s='View this order'}" class="fancybox btn btn-default"><i class="icon-search"></i> {l s="Details"}</a>'; 566 html_orders += ' <a href="#" "title="{l s='Duplicate this order'}" class="duplicate_order btn btn-default" rel="'+this.id_order+'"><i class="icon-arrow-right"></i> {l s="Use"}</a>'; 567 html_orders += '</td>'; 568 html_orders += '</tr>'; 569 }); 570 $('#nonOrderedCarts table tbody').html(html_carts); 571 $('#lastOrders table tbody').html(html_orders); 572 } 573 if (res.id_cart) 574 { 575 id_cart = res.id_cart; 576 $('#id_cart').val(id_cart); 577 } 578 displaySummary(res); 579 resetBind(); 580 } 581 }); 582 } 583 584 function updateDeliveryOptionList(delivery_option_list) 585 { 586 var html = ''; 587 if (delivery_option_list.length > 0) 588 { 589 $.each(delivery_option_list, function() { 590 html += '<option value="'+this.key+'" '+(($('#delivery_option').val() == this.key) ? 'selected="selected"' : '')+'>'+this.name+'</option>'; 591 }); 592 $('#carrier_form').show(); 593 $('#delivery_option').html(html); 594 $('#carriers_err').hide(); 595 $("button[name=\"submitAddOrder\"]").removeAttr("disabled"); 596 } 597 else 598 { 599 $('#carrier_form').hide(); 600 $('#carriers_err').show().html('{l s='No carrier can be applied to this order'}'); 601 $("button[name=\"submitAddOrder\"]").attr("disabled", "disabled"); 602 } 603 } 604 605 function searchProducts() 606 { 607 $('#products_part').show(); 608 $.ajax({ 609 type:"POST", 610 url: "{$link->getAdminLink('AdminOrders')|addslashes}", 611 async: true, 612 dataType: "json", 613 data : { 614 ajax: "1", 615 token: "{$token|escape:'html':'UTF-8'}", 616 tab: "AdminOrders", 617 action: "searchProducts", 618 id_cart: id_cart, 619 id_customer: id_customer, 620 id_currency: id_currency, 621 product_search: $('#product').val()}, 622 success : function(res) 623 { 624 var products_found = ''; 625 var attributes_html = ''; 626 var customization_html = ''; 627 stock = {}; 628 629 if(res.found) 630 { 631 if (!customization_errors) 632 $('#products_err').addClass('hide'); 633 else 634 customization_errors = false; 635 $('#products_found').show(); 636 products_found += '<label class="control-label col-lg-3">{l s='Product'}</label><div class="col-lg-6"><select id="id_product" onclick="display_product_attributes();display_product_customizations();"></div>'; 637 attributes_html += '<label class="control-label col-lg-3">{l s='Combination'}</label><div class="col-lg-6">'; 638 $.each(res.products, function() { 639 products_found += '<option '+(this.combinations.length > 0 ? 'rel="'+this.qty_in_stock+'"' : '')+' value="'+this.id_product+'">'+this.name+(this.combinations.length == 0 ? ' - '+this.formatted_price : '')+'</option>'; 640 attributes_html += '<select class="id_product_attribute" id="ipa_'+this.id_product+'" style="display:none;">'; 641 var id_product = this.id_product; 642 stock[id_product] = new Array(); 643 if (this.customizable == '1' || this.customizable == '2') 644 { 645 customization_html += '<div class="bootstrap"><div class="panel"><div class="panel-heading">{l s='Customization'}</div><form id="customization_'+id_product+'" class="id_customization" method="post" enctype="multipart/form-data" action="'+admin_cart_link+'" style="display:none;">'; 646 customization_html += '<input type="hidden" name="id_product" value="'+id_product+'" />'; 647 customization_html += '<input type="hidden" name="id_cart" value="'+id_cart+'" />'; 648 customization_html += '<input type="hidden" name="action" value="updateCustomizationFields" />'; 649 customization_html += '<input type="hidden" name="id_customer" value="'+id_customer+'" />'; 650 customization_html += '<input type="hidden" name="ajax" value="1" />'; 651 $.each(this.customization_fields, function() { 652 class_customization_field = ""; 653 if (this.required == 1){ class_customization_field = 'required' }; 654 customization_html += '<div class="form-group"><label class="control-label col-lg-3 ' + class_customization_field + '" for="customization_'+id_product+'_'+this.id_customization_field+'">'; 655 customization_html += this.name+'</label><div class="col-lg-9">'; 656 if (this.type == 0) 657 customization_html += '<input class="form-control customization_field" type="file" name="customization_'+id_product+'_'+this.id_customization_field+'" id="customization_'+id_product+'_'+this.id_customization_field+'">'; 658 else if (this.type == 1) 659 customization_html += '<input class="form-control customization_field" type="text" name="customization_'+id_product+'_'+this.id_customization_field+'" id="customization_'+id_product+'_'+this.id_customization_field+'">'; 660 customization_html += '</div></div>'; 661 }); 662 customization_html += '</form></div></div>'; 663 } 664 665 $.each(this.combinations, function() { 666 attributes_html += '<option rel="'+this.qty_in_stock+'" '+(this.default_on == 1 ? 'selected="selected"' : '')+' value="'+this.id_product_attribute+'">'+this.attributes+' - '+this.formatted_price+'</option>'; 667 stock[id_product][this.id_product_attribute] = this.qty_in_stock; 668 }); 669 670 stock[this.id_product][0] = this.stock[0]; 671 attributes_html += '</select>'; 672 }); 673 products_found += '</select></div>'; 674 $('#products_found #product_list').html(products_found); 675 $('#products_found #attributes_list').html(attributes_html); 676 $('link[rel="stylesheet"]').each(function (i, element) { 677 sheet = $(element).clone(); 678 $('#products_found #customization_list').contents().find('head').append(sheet); 679 }); 680 $('#products_found #customization_list').contents().find('body').html(customization_html); 681 display_product_attributes(); 682 display_product_customizations(); 683 $('#id_product').change(); 684 } 685 else 686 { 687 $('#products_found').hide(); 688 $('#products_err').html('{l s='No products found'}'); 689 $('#products_err').removeClass('hide'); 690 } 691 resetBind(); 692 } 693 }); 694 } 695 696 function display_product_customizations() 697 { 698 if ($('#products_found #customization_list').contents().find('#customization_'+$('#id_product option:selected').val()).children().length === 0) 699 $('#customization_list').hide(); 700 else 701 { 702 $('#customization_list').show(); 703 $('#products_found #customization_list').contents().find('.id_customization').hide(); 704 $('#products_found #customization_list').contents().find('#customization_'+$('#id_product option:selected').val()).show(); 705 $('#products_found #customization_list').css('height',$('#products_found #customization_list').contents().find('#customization_'+$('#id_product option:selected').val()).height()+95+'px'); 706 } 707 } 708 709 function display_product_attributes() 710 { 711 if ($('#ipa_'+$('#id_product option:selected').val()+' option').length === 0) 712 $('#attributes_list').hide(); 713 else 714 { 715 $('#attributes_list').show(); 716 $('.id_product_attribute').hide(); 717 $('#ipa_'+$('#id_product option:selected').val()).show(); 718 } 719 } 720 721 function updateCartProducts(products, gifts, id_address_delivery) 722 { 723 var cart_content = ''; 724 $.each(products, function() { 725 var id_product = Number(this.id_product); 726 var id_product_attribute = Number(this.id_product_attribute); 727 cart_quantity[Number(this.id_product)+'_'+Number(this.id_product_attribute)+'_'+Number(this.id_customization)] = this.cart_quantity; 728 cart_content += '<tr><td><img src="'+this.image_link+'" title="'+this.name+'" /></td><td>'+this.name+'<br />'+this.attributes_small+'</td><td>'+this.reference+'</td><td><input type="text" rel="'+this.id_product+'_'+this.id_product_attribute+'" class="product_unit_price" value="' + this.numeric_price + '" /></td><td>'; 729 cart_content += (!this.id_customization ? '<div class="input-group fixed-width-md"><div class="input-group-btn"><a href="#" class="btn btn-default increaseqty_product" rel="'+this.id_product+'_'+this.id_product_attribute+'_'+(this.id_customization ? this.id_customization : 0)+'" ><i class="icon-caret-up"></i></a><a href="#" class="btn btn-default decreaseqty_product" rel="'+this.id_product+'_'+this.id_product_attribute+'_'+(this.id_customization ? this.id_customization : 0)+'"><i class="icon-caret-down"></i></a></div>' : ''); 730 cart_content += (!this.id_customization ? '<input type="text" rel="'+this.id_product+'_'+this.id_product_attribute+'_'+(this.id_customization ? this.id_customization : 0)+'" class="cart_quantity" value="'+this.cart_quantity+'" />' : ''); 731 cart_content += (!this.id_customization ? '<div class="input-group-btn"><a href="#" class="delete_product btn btn-default" rel="delete_'+this.id_product+'_'+this.id_product_attribute+'_'+(this.id_customization ? this.id_customization : 0)+'" ><i class="icon-remove text-danger"></i></a></div></div>' : ''); 732 cart_content += '</td><td>' + displayPrice( 733 this.numeric_total, 734 currency_format, currency_sign, currency_blank 735 ) + '</td></tr>'; 736 737 if (this.id_customization && this.id_customization != 0) 738 { 739 $.each(this.customized_datas[this.id_product][this.id_product_attribute][id_address_delivery], function() { 740 var customized_desc = ''; 741 if (typeof this.datas[1] !== 'undefined' && this.datas[1].length) 742 { 743 $.each(this.datas[1],function() { 744 customized_desc += this.name + ': ' + this.value + '<br />'; 745 id_customization = this.id_customization; 746 }); 747 } 748 if (typeof this.datas[0] !== 'undefined' && this.datas[0].length) 749 { 750 $.each(this.datas[0],function() { 751 customized_desc += this.name + ': <img src="' + pic_dir + this.value + '_small" /><br />'; 752 id_customization = this.id_customization; 753 }); 754 } 755 cart_content += '<tr><td></td><td>'+customized_desc+'</td><td></td><td></td><td>'; 756 cart_content += '<div class="input-group fixed-width-md"><div class="input-group-btn"><a href="#" class="btn btn-default increaseqty_product" rel="'+id_product+'_'+id_product_attribute+'_'+id_customization+'" ><i class="icon-caret-up"></i></a><a href="#" class="btn btn-default decreaseqty_product" rel="'+id_product+'_'+id_product_attribute+'_'+id_customization+'"><i class="icon-caret-down"></i></a></div>'; 757 cart_content += '<input type="text" rel="'+id_product+'_'+id_product_attribute+'_'+id_customization +'" class="cart_quantity" value="'+this.quantity+'" />'; 758 cart_content += '<div class="input-group-btn"><a href="#" class="delete_product btn btn-default" rel="delete_'+id_product+'_'+id_product_attribute+'_'+id_customization+'" ><i class="icon-remove"></i></a></div></div>'; 759 cart_content += '</td><td></td></tr>'; 760 }); 761 } 762 }); 763 764 $.each(gifts, function() { 765 cart_content += '<tr><td><img src="'+this.image_link+'" title="'+this.name+'" /></td><td>'+this.name+'<br />'+this.attributes_small+'</td><td>'+this.reference+'</td>'; 766 cart_content += '<td>{l s='Gift'}</td><td>'+this.cart_quantity+'</td><td>{l s='Gift'}</td></tr>'; 767 }); 768 $('#customer_cart tbody').html(cart_content); 769 } 770 771 function updateCartVouchers(vouchers) 772 { 773 var vouchers_html = ''; 774 if (typeof(vouchers) == 'object') 775 $.each(vouchers, function(){ 776 if (parseFloat(this.value_real) === 0 && parseInt(this.free_shipping) === 1) 777 var value = '{l s='Free shipping'}'; 778 else 779 var value = this.value_real; 780 781 vouchers_html += '<tr><td>'+this.name+'</td><td>'+this.description+'</td><td>'+value+'</td><td class="text-right"><a href="#" class="btn btn-default delete_discount" rel="'+this.id_discount+'"><i class="icon-remove text-danger"></i> {l s='Delete'}</a></td></tr>'; 782 }); 783 $('#voucher_list tbody').html($.trim(vouchers_html)); 784 if ($('#voucher_list tbody').html().length == 0) 785 $('#voucher_list').hide(); 786 else 787 $('#voucher_list').show(); 788 } 789 790 function updateCartPaymentList(payment_list) 791 { 792 $('#payment_list').html(payment_list); 793 } 794 795 function fixPriceFormat(price) 796 { 797 console.log('Deprecated with v1.1.0. Use parseFloat() instead.'); 798 799 if(price.indexOf(',') > 0 && price.indexOf('.') > 0) // if contains , and . 800 if(price.indexOf(',') < price.indexOf('.')) // if , is before . 801 price = price.replace(',',''); // remove , 802 price = price.replace(' ',''); // remove any spaces 803 price = price.replace(',','.'); // remove , if price did not cotain both , and . 804 return price; 805 } 806 807 function displaySummary(jsonSummary) 808 { 809 currency_format = jsonSummary.currency.format; 810 currency_sign = jsonSummary.currency.sign; 811 currency_blank = jsonSummary.currency.blank; 812 if (jsonSummary.currency.decimals) { 813 priceDisplayPrecision = {$smarty.const._PS_PRICE_DISPLAY_PRECISION_}; 814 } else { 815 priceDisplayPrecision = 0; 816 } 817 818 updateCartProducts(jsonSummary.summary.products, jsonSummary.summary.gift_products, jsonSummary.cart.id_address_delivery); 819 updateCartVouchers(jsonSummary.summary.discounts); 820 updateAddressesList(jsonSummary.addresses, jsonSummary.cart.id_address_delivery, jsonSummary.cart.id_address_invoice); 821 822 if (!jsonSummary.summary.products.length || !jsonSummary.addresses.length || !jsonSummary.delivery_option_list) 823 $('#carriers_part,#summary_part').hide(); 824 else 825 $('#carriers_part,#summary_part').show(); 826 827 updateDeliveryOptionList(jsonSummary.delivery_option_list); 828 829 if (jsonSummary.cart.gift == 1) 830 $('#order_gift').attr('checked', true); 831 else 832 $('#carrier_gift').removeAttr('checked'); 833 if (jsonSummary.cart.recyclable == 1) 834 $('#carrier_recycled_package').attr('checked', true); 835 else 836 $('#carrier_recycled_package').removeAttr('checked'); 837 if (jsonSummary.free_shipping == 1) 838 $('#free_shipping').attr('checked', true); 839 else 840 $('#free_shipping_off').attr('checked', true); 841 842 $('#gift_message').html(jsonSummary.cart.gift_message); 843 if ( ! changed_shipping_price) { 844 $('#shipping_price').html('<b>' + displayPrice( 845 jsonSummary.summary.total_shipping, 846 currency_format, currency_sign, currency_blank 847 ) + '</b>'); 848 } 849 shipping_price_selected_carrier = jsonSummary.summary.total_shipping; 850 851 $('#total_vouchers').html(displayPrice( 852 jsonSummary.summary.total_discounts_tax_exc, 853 currency_format, currency_sign, currency_blank 854 )); 855 $('#total_shipping').html(displayPrice( 856 jsonSummary.summary.total_shipping_tax_exc, 857 currency_format, currency_sign, currency_blank 858 )); 859 $('#total_taxes').html(displayPrice( 860 jsonSummary.summary.total_tax, 861 currency_format, currency_sign, currency_blank 862 )); 863 $('#total_without_taxes').html(displayPrice( 864 jsonSummary.summary.total_price_without_tax, 865 currency_format, currency_sign, currency_blank 866 )); 867 $('#total_with_taxes').html(displayPrice( 868 jsonSummary.summary.total_price, 869 currency_format, currency_sign, currency_blank 870 )); 871 $('#total_products').html(displayPrice( 872 jsonSummary.summary.total_products, 873 currency_format, currency_sign, currency_blank 874 )); 875 id_currency = jsonSummary.cart.id_currency; 876 $('#id_currency option').removeAttr('selected'); 877 $('#id_currency option[value="'+id_currency+'"]').attr('selected', true); 878 id_lang = jsonSummary.cart.id_lang; 879 $('#id_lang option').removeAttr('selected'); 880 $('#id_lang option[value="'+id_lang+'"]').attr('selected', true); 881 $('#send_email_to_customer').attr('rel', jsonSummary.link_order); 882 $('#go_order_process').attr('href', jsonSummary.link_order); 883 $('#order_message').val(jsonSummary.order_message); 884 resetBind(); 885 } 886 887 function updateQty(id_product, id_product_attribute, id_customization, qty) 888 { 889 $.ajax({ 890 type:"POST", 891 url: "{$link->getAdminLink('AdminCarts')|addslashes}", 892 async: true, 893 dataType: "json", 894 data : { 895 ajax: "1", 896 token: "{getAdminToken tab='AdminCarts'}", 897 tab: "AdminCarts", 898 action: "updateQty", 899 id_product: id_product, 900 id_product_attribute: id_product_attribute, 901 id_customization: id_customization, 902 qty: qty, 903 id_customer: id_customer, 904 id_cart: id_cart, 905 }, 906 success : function(res) 907 { 908 displaySummary(res); 909 var errors = ''; 910 if (res.errors.length) 911 { 912 $.each(res.errors, function() { 913 errors += this + '<br />'; 914 }); 915 $('#products_err').removeClass('hide'); 916 } 917 else 918 $('#products_err').addClass('hide'); 919 $('#products_err').html(errors); 920 } 921 }); 922 } 923 924 function resetShippingPrice() 925 { 926 $('#shipping_price').val(displayPriceValue(shipping_price_selected_carrier)); 927 changed_shipping_price = false; 928 } 929 930 function addProduct() 931 { 932 var id_product = $('#id_product option:selected').val(); 933 $('#products_found #customization_list').contents().find('#customization_'+id_product).submit(); 934 935 addProductProcess(); 936 } 937 938 //Called from form_customization_feedback.tpl 939 function customizationProductListener() 940 { 941 //refresh form customization 942 searchProducts(); 943 944 // addProductProcess(); 945 } 946 947 function addProductProcess() 948 { 949 if (customization_errors) { 950 $('#products_err').removeClass('hide'); 951 } else { 952 $('#products_err').addClass('hide'); 953 updateQty($('#id_product').val(), $('#ipa_'+$('#id_product').val()+' option:selected').val(), 0, $('#qty').val()); 954 } 955 } 956 957 function updateCurrency() 958 { 959 $.ajax({ 960 type:"POST", 961 url: "{$link->getAdminLink('AdminCarts')|addslashes}", 962 async: true, 963 dataType: "json", 964 data : { 965 ajax: "1", 966 token: "{getAdminToken tab='AdminCarts'}", 967 tab: "AdminCarts", 968 action: "updateCurrency", 969 id_currency: $('#id_currency option:selected').val(), 970 id_customer: id_customer, 971 id_cart: id_cart 972 }, 973 success : function(res) 974 { 975 displaySummary(res); 976 } 977 }); 978 } 979 980 function updateLang() 981 { 982 $.ajax({ 983 type:"POST", 984 url: "{$link->getAdminLink('AdminCarts')|addslashes}", 985 async: true, 986 dataType: "json", 987 data : { 988 ajax: "1", 989 token: "{getAdminToken tab='AdminCarts'}", 990 tab: "admincarts", 991 action: "updateLang", 992 id_lang: $('#id_lang option:selected').val(), 993 id_customer: id_customer, 994 id_cart: id_cart 995 }, 996 success : function(res) 997 { 998 displaySummary(res); 999 } 1000 }); 1001 } 1002 1003 function updateDeliveryOption() 1004 { 1005 $.ajax({ 1006 type:"POST", 1007 url: "{$link->getAdminLink('AdminCarts')|addslashes}", 1008 async: true, 1009 dataType: "json", 1010 data : { 1011 ajax: "1", 1012 token: "{getAdminToken tab='AdminCarts'}", 1013 tab: "AdminCarts", 1014 action: "updateDeliveryOption", 1015 delivery_option: $('#delivery_option option:selected').val(), 1016 gift: $('#order_gift').is(':checked')?1:0, 1017 gift_message: $('#gift_message').val(), 1018 recyclable: $('#carrier_recycled_package').is(':checked')?1:0, 1019 id_customer: id_customer, 1020 id_cart: id_cart 1021 }, 1022 success : function(res) 1023 { 1024 displaySummary(res); 1025 } 1026 }); 1027 } 1028 1029 function sendMailToCustomer() 1030 { 1031 $.ajax({ 1032 type:"POST", 1033 url: "{$link->getAdminLink('AdminOrders')|addslashes}", 1034 async: true, 1035 dataType: "json", 1036 data : { 1037 ajax: "1", 1038 token: "{getAdminToken tab='AdminOrders'}", 1039 tab: "AdminOrders", 1040 action: "sendMailValidateOrder", 1041 id_customer: id_customer, 1042 id_cart: id_cart 1043 }, 1044 success : function(res) 1045 { 1046 if (res.errors) 1047 $('#send_email_feedback').removeClass('hide').removeClass('alert-success').addClass('alert-danger'); 1048 else 1049 $('#send_email_feedback').removeClass('hide').removeClass('alert-danger').addClass('alert-success'); 1050 $('#send_email_feedback').html(res.result); 1051 } 1052 }); 1053 } 1054 1055 function updateAddressesList(addresses, id_address_delivery, id_address_invoice) 1056 { 1057 var addresses_delivery_options = ''; 1058 var addresses_invoice_options = ''; 1059 var address_invoice_detail = ''; 1060 var address_delivery_detail = ''; 1061 var delivery_address_edit_link = ''; 1062 var invoice_address_edit_link = ''; 1063 1064 $.each(addresses, function() { 1065 if (this.id_address == id_address_invoice) 1066 { 1067 address_invoice_detail = this.formated_address; 1068 invoice_address_edit_link = "{$link->getAdminLink('AdminAddresses')}&id_address="+this.id_address+"&updateaddress&realedit=1&liteDisplaying=1&submitFormAjax=1#"; 1069 } 1070 1071 if(this.id_address == id_address_delivery) 1072 { 1073 address_delivery_detail = this.formated_address; 1074 delivery_address_edit_link = "{$link->getAdminLink('AdminAddresses')}&id_address="+this.id_address+"&updateaddress&realedit=1&liteDisplaying=1&submitFormAjax=1#"; 1075 } 1076 1077 addresses_delivery_options += '<option value="'+this.id_address+'" '+(this.id_address == id_address_delivery ? 'selected="selected"' : '')+'>'+this.alias+'</option>'; 1078 addresses_invoice_options += '<option value="'+this.id_address+'" '+(this.id_address == id_address_invoice ? 'selected="selected"' : '')+'>'+this.alias+'</option>'; 1079 }); 1080 if (addresses.length == 0) 1081 { 1082 $('#addresses_err').show().html('{l s='You must add at least one address to process the order.'}'); 1083 $('#address_delivery, #address_invoice').hide(); 1084 } 1085 else 1086 { 1087 $('#addresses_err').hide(); 1088 $('#address_delivery, #address_invoice').show(); 1089 } 1090 1091 $('#id_address_delivery').html(addresses_delivery_options); 1092 $('#id_address_invoice').html(addresses_invoice_options); 1093 $('#address_delivery_detail').html(address_delivery_detail); 1094 $('#address_invoice_detail').html(address_invoice_detail); 1095 $('#edit_delivery_address').attr('href', delivery_address_edit_link); 1096 $('#edit_invoice_address').attr('href', invoice_address_edit_link); 1097 } 1098 1099 function updateAddresses() 1100 { 1101 $.ajax({ 1102 type:"POST", 1103 url: "{$link->getAdminLink('AdminCarts')|addslashes}", 1104 async: true, 1105 dataType: "json", 1106 data : { 1107 ajax: "1", 1108 token: "{getAdminToken tab='AdminCarts'}", 1109 tab: "AdminCarts", 1110 action: "updateAddresses", 1111 id_customer: id_customer, 1112 id_cart: id_cart, 1113 id_address_delivery: $('#id_address_delivery option:selected').val(), 1114 id_address_invoice: $('#id_address_invoice option:selected').val() 1115 }, 1116 success : function(res) 1117 { 1118 updateDeliveryOption(); 1119 } 1120 }); 1121 } 1122</script> 1123 1124<div class="leadin">{block name="leadin"}{/block}</div> 1125 <div class="panel form-horizontal" id="customer_part"> 1126 <div class="panel-heading"> 1127 <i class="icon-user"></i> 1128 {l s='Customer'} 1129 </div> 1130 <div id="search-customer-form-group" class="form-group"> 1131 <label class="control-label col-lg-3"> 1132 <span title="" data-toggle="tooltip" class="label-tooltip" data-original-title="{l s='Search for an existing customer by typing the first letters of his/her name.'}"> 1133 {l s='Search for a customer'} 1134 </span> 1135 </label> 1136 <div class="col-lg-9"> 1137 <div class="row"> 1138 <div class="col-lg-6"> 1139 <div class="input-group"> 1140 <input type="text" id="customer" value="" /> 1141 <span class="input-group-addon"> 1142 <i class="icon-search"></i> 1143 </span> 1144 </div> 1145 </div> 1146 <div class="col-lg-6"> 1147 <span class="form-control-static">{l s='Or'} </span> 1148 <a class="fancybox_customer btn btn-default" href="{$link->getAdminLink('AdminCustomers')|escape:'html':'UTF-8'}&addcustomer&liteDisplaying=1&submitFormAjax=1#"> 1149 <i class="icon-plus-sign-alt"></i> 1150 {l s='Add new customer'} 1151 </a> 1152 </div> 1153 </div> 1154 </div> 1155 </div> 1156 <div class="row"> 1157 <div id="customers"></div> 1158 </div> 1159 <div id="carts"> 1160 <button type="button" id="show_old_carts" class="btn btn-default pull-right" data-toggle="collapse" data-target="#old_carts_orders"> 1161 <i class="icon-caret-down"></i> 1162 </button> 1163 1164 <ul id="old_carts_orders_navtab" class="nav nav-tabs"> 1165 <li class="active"> 1166 <a href="#nonOrderedCarts" data-toggle="tab"> 1167 <i class="icon-shopping-cart"></i> 1168 {l s='Carts'} 1169 </a> 1170 </li> 1171 <li> 1172 <a href="#lastOrders" data-toggle="tab"> 1173 <i class="icon-credit-card"></i> 1174 {l s='Orders'} 1175 </a> 1176 </li> 1177 </ul> 1178 <div id="old_carts_orders" class="tab-content panel collapse in"> 1179 <div id="nonOrderedCarts" class="tab-pane active"> 1180 <table class="table"> 1181 <thead> 1182 <tr> 1183 <th><span class="title_box">{l s='ID'}</span></th> 1184 <th><span class="title_box">{l s='Date'}</span></th> 1185 <th><span class="title_box">{l s='Total'}</span></th> 1186 <th></th> 1187 </tr> 1188 </thead> 1189 <tbody> 1190 </tbody> 1191 </table> 1192 </div> 1193 <div id="lastOrders" class="tab-pane"> 1194 <table class="table"> 1195 <thead> 1196 <tr> 1197 <th><span class="title_box">{l s='ID'}</span></th> 1198 <th><span class="title_box">{l s='Date'}</span></th> 1199 <th><span class="title_box">{l s='Products'}</span></th> 1200 <th><span class="title_box">{l s='Total paid'}</span></th> 1201 <th><span class="title_box">{l s='Payment'}</span></th> 1202 <th><span class="title_box">{l s='Status'}</span></th> 1203 <th></th> 1204 </tr> 1205 </thead> 1206 <tbody> 1207 </tbody> 1208 </table> 1209 </div> 1210 </div> 1211 </div> 1212 </div> 1213 1214 1215<form class="form-horizontal" action="{$link->getAdminLink('AdminOrders')|escape:'html':'UTF-8'}&submitAdd{$table|escape:'html':'UTF-8'}=1" method="post" autocomplete="off"> 1216 <div class="panel" id="products_part" style="display:none;"> 1217 <div class="panel-heading"> 1218 <i class="icon-shopping-cart"></i> 1219 {l s='Cart'} 1220 </div> 1221 <div class="form-group"> 1222 <label class="control-label col-lg-3"> 1223 <span title="" data-toggle="tooltip" class="label-tooltip" data-original-title="{l s='Search for an existing product by typing the first letters of its name.'}"> 1224 {l s='Search for a product'} 1225 </span> 1226 </label> 1227 <div class="col-lg-9"> 1228 <input type="hidden" value="" id="id_cart" name="id_cart" /> 1229 <div class="input-group"> 1230 <input type="text" id="product" value="" /> 1231 <span class="input-group-addon"> 1232 <i class="icon-search"></i> 1233 </span> 1234 </div> 1235 </div> 1236 </div> 1237 1238 <div id="products_found"> 1239 <hr/> 1240 <div id="product_list" class="form-group"></div> 1241 <div id="attributes_list" class="form-group"></div> 1242 <!-- @TODO: please be kind refacto --> 1243 <div class="form-group"> 1244 <div class="col-lg-9 col-lg-offset-3"> 1245 <iframe id="customization_list" seamless> 1246 <html> 1247 <head> 1248 {if isset($css_files_orders)} 1249 {foreach from=$css_files_orders key=css_uri item=media} 1250 <link href="{$css_uri}" rel="stylesheet" type="text/css" media="{$media}" /> 1251 {/foreach} 1252 {/if} 1253 </head> 1254 <body> 1255 </body> 1256 </html> 1257 </iframe> 1258 </div> 1259 </div> 1260 <div class="form-group"> 1261 <label class="control-label col-lg-3" for="qty">{l s='Quantity'}</label> 1262 <div class="col-lg-9"> 1263 <input type="text" name="qty" id="qty" class="form-control fixed-width-sm" value="1" /> 1264 <p class="help-block">{l s='In stock'} <span id="qty_in_stock"></span></p> 1265 </div> 1266 </div> 1267 1268 <div class="form-group"> 1269 <div class="col-lg-9 col-lg-offset-3"> 1270 <button type="button" class="btn btn-default" id="submitAddProduct" /> 1271 <i class="icon-ok text-success"></i> 1272 {l s='Add to cart'} 1273 </div> 1274 </div> 1275 </div> 1276 1277 <div id="products_err" class="hide alert alert-danger"></div> 1278 1279 <hr/> 1280 1281 <div class="row"> 1282 <div class="col-lg-12"> 1283 <table class="table" id="customer_cart"> 1284 <thead> 1285 <tr> 1286 <th><span class="title_box">{l s='Product'}</span></th> 1287 <th><span class="title_box">{l s='Description'}</span></th> 1288 <th><span class="title_box">{l s='Reference'}</span></th> 1289 <th><span class="title_box">{l s='Unit price'}</span></th> 1290 <th><span class="title_box">{l s='Quantity'}</span></th> 1291 <th><span class="title_box">{l s='Price'}</span></th> 1292 </tr> 1293 </thead> 1294 <tbody> 1295 </tbody> 1296 </table> 1297 </div> 1298 </div> 1299 1300 <div class="form-group"> 1301 <div class="col-lg-9 col-lg-offset-3"> 1302 <div class="alert alert-warning">{l s='The prices are without taxes.'}</div> 1303 </div> 1304 </div> 1305 1306 <div class="form-group"> 1307 <label class="control-label col-lg-3" for="id_currency"> 1308 {l s='Currency'} 1309 </label> 1310 <script type="text/javascript"> 1311 {foreach from=$currencies item='currency'} 1312 currencies['{$currency.id_currency}'] = '{$currency.sign}'; 1313 {/foreach} 1314 </script> 1315 <div class="col-lg-9"> 1316 <select id="id_currency" name="id_currency"> 1317 {foreach from=$currencies item='currency'} 1318 <option rel="{$currency.iso_code}" value="{$currency.id_currency}">{$currency.name}</option> 1319 {/foreach} 1320 </select> 1321 </div> 1322 </div> 1323 <div class="form-group"> 1324 <label class="control-label col-lg-3" for="id_lang"> 1325 {l s='Language'} 1326 </label> 1327 <div class="col-lg-9"> 1328 <select id="id_lang" name="id_lang"> 1329 {foreach from=$langs item='lang'} 1330 <option value="{$lang.id_lang}">{$lang.name}</option> 1331 {/foreach} 1332 </select> 1333 </div> 1334 </div> 1335 </div> 1336 1337 <div class="panel" id="vouchers_part" style="display:none;"> 1338 <div class="panel-heading"> 1339 <i class="icon-ticket"></i> 1340 {l s='Vouchers'} 1341 </div> 1342 <div class="form-group"> 1343 <label class="control-label col-lg-3"> 1344 {l s='Search for a voucher'} 1345 </label> 1346 <div class="col-lg-9"> 1347 <div class="row"> 1348 <div class="col-lg-6"> 1349 <div class="input-group"> 1350 <input type="text" id="voucher" value="" /> 1351 <div class="input-group-addon"> 1352 <i class="icon-search"></i> 1353 </div> 1354 </div> 1355 </div> 1356 <div class="col-lg-6"> 1357 <span class="form-control-static">{l s='Or'} </span> 1358 <a class="fancybox btn btn-default" href="{$link->getAdminLink('AdminCartRules')|escape:'html':'UTF-8'}&addcart_rule&liteDisplaying=1&submitFormAjax=1#"> 1359 <i class="icon-plus-sign-alt"></i> 1360 {l s='Add new voucher'} 1361 </a> 1362 </div> 1363 </div> 1364 </div> 1365 </div> 1366 <div class="row"> 1367 <table class="table" id="voucher_list"> 1368 <thead> 1369 <tr> 1370 <th><span class="title_box">{l s='Name'}</span></th> 1371 <th><span class="title_box">{l s='Description'}</span></th> 1372 <th><span class="title_box">{l s='Value'}</span></th> 1373 <th></th> 1374 </tr> 1375 </thead> 1376 <tbody> 1377 </tbody> 1378 </table> 1379 </div> 1380 <div id="vouchers_err" class="alert alert-warning" style="display:none;"></div> 1381 </div> 1382 1383 <div class="panel" id="address_part" style="display:none;"> 1384 <div class="panel-heading"> 1385 <i class="icon-envelope"></i> 1386 {l s='Addresses'} 1387 </div> 1388 <div id="addresses_err" class="alert alert-warning" style="display:none;"></div> 1389 1390 <div class="row"> 1391 <div id="address_delivery" class="col-lg-6"> 1392 <h4> 1393 <i class="icon-truck"></i> 1394 {l s='Delivery'} 1395 </h4> 1396 <div class="row-margin-bottom"> 1397 <select id="id_address_delivery" name="id_address_delivery"></select> 1398 </div> 1399 <div class="well"> 1400 <a href="" id="edit_delivery_address" class="btn btn-default pull-right fancybox"><i class="icon-pencil"></i> {l s='Edit'}</a> 1401 <div id="address_delivery_detail"></div> 1402 </div> 1403 </div> 1404 <div id="address_invoice" class="col-lg-6"> 1405 <h4> 1406 <i class="icon-file-text"></i> 1407 {l s='Invoice'} 1408 </h4> 1409 <div class="row-margin-bottom"> 1410 <select id="id_address_invoice" name="id_address_invoice"></select> 1411 </div> 1412 <div class="well"> 1413 <a href="" id="edit_invoice_address" class="btn btn-default pull-right fancybox"><i class="icon-pencil"></i> {l s='Edit'}</a> 1414 <div id="address_invoice_detail"></div> 1415 </div> 1416 </div> 1417 </div> 1418 <div class="row"> 1419 <div class="col-lg-12"> 1420 <a class="fancybox btn btn-default" id="new_address" href="{$link->getAdminLink('AdminAddresses')|escape:'html':'UTF-8'}&addaddress&id_customer=42&liteDisplaying=1&submitFormAjax=1#"> 1421 <i class="icon-plus-sign-alt"></i> 1422 {l s='Add a new address'} 1423 </a> 1424 </div> 1425 </div> 1426 </div> 1427 <div class="panel" id="carriers_part" style="display:none;"> 1428 <div class="panel-heading"> 1429 <i class="icon-truck"></i> 1430 {l s='Shipping'} 1431 </div> 1432 <div id="carriers_err" style="display:none;" class="alert alert-warning"></div> 1433 <div id="carrier_form"> 1434 <div class="form-group"> 1435 <label class="control-label col-lg-3"> 1436 {l s='Delivery option'} 1437 </label> 1438 <div class="col-lg-9"> 1439 <select name="delivery_option" id="delivery_option"> 1440 </select> 1441 </div> 1442 </div> 1443 <div class="form-group"> 1444 <label class="control-label col-lg-3" for="shipping_price"> 1445 {l s='Shipping price (Tax incl.)'} 1446 </label> 1447 <div class="col-lg-9"> 1448 <p id="shipping_price" class="form-control-static" name="shipping_price"></p> 1449 </div> 1450 </div> 1451 <div class="form-group"> 1452 <label class="control-label col-lg-3" for="free_shipping"> 1453 {l s='Free shipping'} 1454 </label> 1455 <div class="input-group col-lg-9 fixed-width-lg"> 1456 <span class="switch prestashop-switch"> 1457 <input type="radio" name="free_shipping" id="free_shipping" value="1"> 1458 <label for="free_shipping" class="radioCheck"> 1459 {l s='yes'} 1460 </label> 1461 <input type="radio" name="free_shipping" id="free_shipping_off" value="0" checked="checked"> 1462 <label for="free_shipping_off" class="radioCheck"> 1463 {l s='No'} 1464 </label> 1465 <a class="slide-button btn"></a> 1466 </span> 1467 </div> 1468 </div> 1469 1470 {if $recyclable_pack} 1471 <div class="form-group"> 1472 <div class="checkbox col-lg-9 col-offset-3"> 1473 <label for="carrier_recycled_package"> 1474 <input type="checkbox" name="carrier_recycled_package" value="1" id="carrier_recycled_package" /> 1475 {l s='Recycled package'} 1476 </label> 1477 </div> 1478 </div> 1479 {/if} 1480 1481 {if $gift_wrapping} 1482 <div class="form-group"> 1483 <div class="checkbox col-lg-9 col-offset-3"> 1484 <label for="order_gift"> 1485 <input type="checkbox" name="order_gift" id="order_gift" value="1" /> 1486 {l s='Gift'} 1487 </label> 1488 </div> 1489 </div> 1490 <div class="form-group"> 1491 <label class="control-label col-lg-3" for="gift_message">{l s='Gift message'}</label> 1492 <div class="col-lg-9"> 1493 <textarea id="gift_message" class="form-control" cols="40" rows="4"></textarea> 1494 </div> 1495 </div> 1496 {/if} 1497 </div> 1498 </div> 1499 <div class="panel" id="summary_part" style="display:none;"> 1500 <div class="panel-heading"> 1501 <i class="icon-align-justify"></i> 1502 {l s='Summary'} 1503 </div> 1504 1505 <div id="send_email_feedback" class="hide alert"></div> 1506 1507 <div id="cart_summary" class="panel row-margin-bottom text-center"> 1508 <div class="row"> 1509 <div class="col-lg-2"> 1510 <div class="data-focus"> 1511 <span>{l s='Total products'}</span><br/> 1512 <span id="total_products" class="size_l text-success"></span> 1513 </div> 1514 </div> 1515 <div class="col-lg-2"> 1516 <div class="data-focus"> 1517 <span>{l s='Total vouchers (Tax excl.)'}</span><br/> 1518 <span id="total_vouchers" class="size_l text-danger"></span> 1519 </div> 1520 </div> 1521 <div class="col-lg-2"> 1522 <div class="data-focus"> 1523 <span>{l s='Total shipping (Tax excl.)'}</span><br/> 1524 <span id="total_shipping" class="size_l"></span> 1525 </div> 1526 </div> 1527 <div class="col-lg-2"> 1528 <div class="data-focus"> 1529 <span>{l s='Total taxes'}</span><br/> 1530 <span id="total_taxes" class="size_l"></span> 1531 </div> 1532 </div> 1533 <div class="col-lg-2"> 1534 <div class="data-focus"> 1535 <span>{l s='Total (Tax excl.)'}</span><br/> 1536 <span id="total_without_taxes" class="size_l"></span> 1537 </div> 1538 </div> 1539 <div class="col-lg-2"> 1540 <div class="data-focus data-focus-primary"> 1541 <span>{l s='Total (Tax incl.)'}</span><br/> 1542 <span id="total_with_taxes" class="size_l"></span> 1543 </div> 1544 </div> 1545 </div> 1546 </div> 1547 1548 <div class="row"> 1549 <div class="order_message_right col-lg-12"> 1550 <div class="form-group"> 1551 <label class="control-label col-lg-3" for="order_message">{l s='Order message'}</label> 1552 <div class="col-lg-6"> 1553 <textarea name="order_message" id="order_message" rows="3" cols="45"></textarea> 1554 </div> 1555 </div> 1556 <div class="form-group"> 1557 {if !$PS_CATALOG_MODE} 1558 <div class="col-lg-9 col-lg-offset-3"> 1559 <a href="javascript:void(0);" id="send_email_to_customer" class="btn btn-default"> 1560 <i class="icon-credit-card"></i> 1561 {l s='Send an email to the customer with the link to process the payment.'} 1562 </a> 1563 <a id="go_order_process" href="" class="btn btn-link _blank"> 1564 {l s='Go on payment page to process the payment.'} 1565 <i class="icon-external-link"></i> 1566 </a> 1567 </div> 1568 {/if} 1569 </div> 1570 <div class="form-group"> 1571 <label class="control-label col-lg-3">{l s='Payment'}</label> 1572 <div class="col-lg-9"> 1573 <select name="payment_module_name" id="payment_module_name"> 1574 {if !$PS_CATALOG_MODE} 1575 {foreach from=$payment_modules item='module'} 1576 <option value="{$module->name}" {if isset($smarty.post.payment_module_name) && $module->name == $smarty.post.payment_module_name}selected="selected"{/if}>{$module->displayName}</option> 1577 {/foreach} 1578 {else} 1579 <option value="boorder">{l s='Back office order'}</option> 1580 {/if} 1581 </select> 1582 </div> 1583 </div> 1584 <div class="form-group"> 1585 <label class="control-label col-lg-3">{l s='Order status'}</label> 1586 <div class="col-lg-9"> 1587 <select name="id_order_state" id="id_order_state"> 1588 {foreach from=$order_states item='order_state'} 1589 <option value="{$order_state.id_order_state}" {if isset($smarty.post.id_order_state) && $order_state.id_order_state == $smarty.post.id_order_state}selected="selected"{/if}>{$order_state.name}</option> 1590 {/foreach} 1591 </select> 1592 </div> 1593 </div> 1594 <div class="form-group"> 1595 <div class="col-lg-9 col-lg-offset-3"> 1596 <button type="submit" name="submitAddOrder" class="btn btn-default" /> 1597 <i class="icon-check"></i> 1598 {l s='Create the order'} 1599 </button> 1600 </div> 1601 </div> 1602 </div> 1603 </div> 1604 </div> 1605</form> 1606 1607<div id="loader_container"> 1608 <div id="loader"></div> 1609</div> 1610