From de4cb8a0969250e2439c69495ee6c106de3d2fae Mon Sep 17 00:00:00 2001 From: Damien Metzger Date: Tue, 16 Jul 2013 18:16:02 +0200 Subject: [PATCH] // Carrier Wizard summary (just started) --- .../carrier_wizard/helpers/form/form.tpl | 2 +- .../controllers/carrier_wizard/summary.tpl | 35 +++++++++++-- .../admin/AdminCarrierWizardController.php | 4 +- js/admin_carrier_wizard.js | 50 +++++++++++++++++++ 4 files changed, 84 insertions(+), 7 deletions(-) diff --git a/admin-dev/themes/default/template/controllers/carrier_wizard/helpers/form/form.tpl b/admin-dev/themes/default/template/controllers/carrier_wizard/helpers/form/form.tpl index de063bb64..3a62f3ac9 100644 --- a/admin-dev/themes/default/template/controllers/carrier_wizard/helpers/form/form.tpl +++ b/admin-dev/themes/default/template/controllers/carrier_wizard/helpers/form/form.tpl @@ -63,7 +63,7 @@ {foreach from=$zones key=i item=zone} {$zone.name} - + {foreach from=$ranges key=r item=range} {/foreach} diff --git a/admin-dev/themes/default/template/controllers/carrier_wizard/summary.tpl b/admin-dev/themes/default/template/controllers/carrier_wizard/summary.tpl index ca877ac0f..483b85f3e 100644 --- a/admin-dev/themes/default/template/controllers/carrier_wizard/summary.tpl +++ b/admin-dev/themes/default/template/controllers/carrier_wizard/summary.tpl @@ -23,8 +23,35 @@ * International Registered Trademark & Property of PrestaShop SA *} + +
- - - -
\ No newline at end of file + {l s='Summary'} - +
+
 
+
+
 
+
+
 
+
+ {l s='It will be displayed only for the following zones:'} + +
+
 
+
+ {l s='It will be displayed only for the following groups:'} + +
+ diff --git a/controllers/admin/AdminCarrierWizardController.php b/controllers/admin/AdminCarrierWizardController.php index b8fcf7240..51be7fbd2 100644 --- a/controllers/admin/AdminCarrierWizardController.php +++ b/controllers/admin/AdminCarrierWizardController.php @@ -229,12 +229,12 @@ class AdminCarrierWizardControllerCore extends AdminController 'class' => 't', 'values' => array( array( - 'id' => 'is_free_on', + 'id' => 'is_free_off', 'value' => 0, 'label' => ''.$this->l('Yes').'' ), array( - 'id' => 'is_free_off', + 'id' => 'is_free_on', 'value' => 1, 'label' => ''.$this->l('No').'' ) diff --git a/js/admin_carrier_wizard.js b/js/admin_carrier_wizard.js index 60ed8e86b..4dd3c7a94 100644 --- a/js/admin_carrier_wizard.js +++ b/js/admin_carrier_wizard.js @@ -83,7 +83,57 @@ function onLeaveStepCallback(obj, context) function displaySummary() { + // Carrier name + $('#summary_name').html($('#name').val()); + // Delay and pricing + $('#summary_meta_informations').html(summary_translation_meta_informations); + if ($('#is_free_on').attr('checked')) + $('#summary_meta_informations').html($('#summary_meta_informations').html().replace('@s1', summary_translation_free)); + else + $('#summary_meta_informations').html($('#summary_meta_informations').html().replace('@s1', summary_translation_paid)); + $('#summary_meta_informations').html($('#summary_meta_informations').html().replace('@s2', $('#delay_1').val())); + + // Tax and calculation mode for the shipping cost + $('#summary_shipping_cost').html(summary_translation_shipping_cost); + if ($('#billing_price').attr('checked')) + $('#summary_shipping_cost').html($('#summary_shipping_cost').html().replace('@s1', summary_translation_price)); + else if ($('#billing_weight').attr('checked')) + $('#summary_shipping_cost').html($('#summary_shipping_cost').html().replace('@s1', summary_translation_weight)); + else + $('#summary_shipping_cost').html($('#summary_shipping_cost').html().replace('@s1', '' + summary_translation_undefined + '')); + $('#summary_shipping_cost').html($('#summary_shipping_cost').html().replace('@s2', '' + $('#id_tax_rules_group option:selected').text() + '')); + + // Weight or price ranges + $('#summary_range').html(summary_translation_range); + var range_inf, range_sup; + range_inf = summary_translation_undefined; + range_sup = summary_translation_undefined; + $('input[name$="range_inf[]"]').each(function(){ + if (!isNaN(parseFloat($(this).val())) && (range_inf == summary_translation_undefined || range_inf < $(this).val())) + range_inf = $(this).val(); + }); + $('input[name$="range_sup[]"]').each(function(){ + if (!isNaN(parseFloat($(this).val())) && (range_sup == summary_translation_undefined || range_sup > $(this).val())) + range_sup = $(this).val(); + }); + $('#summary_range').html($('#summary_range').html().replace('@s1', '' + range_inf + '')); + $('#summary_range').html($('#summary_range').html().replace('@s2', '' + range_sup + '')); + $('#summary_range').html($('#summary_range').html().replace('@s3', '' + $('#range_behavior option:selected').text().toLowerCase() + '')); + + // Delivery zones + $('#summary_zones').html(''); + $('.input_zone').each(function(){ + if ($(this).attr('checked')) + $('#summary_zones').html($('#summary_zones').html() + '
  • ' + $(this).parent().prev().text() + '
  • '); + }); + + // Group restrictions + $('#summary_groups').html(''); + $('input[name$="groupBox[]"]').each(function(){ + if ($(this).attr('checked')) + $('#summary_groups').html($('#summary_groups').html() + '
  • ' + $(this).parent().next().next().text() + '
  • '); + }); } function validateSteps(step_number)