From 478e338df0b42a2af1b7ca784d5e9e73a8537f29 Mon Sep 17 00:00:00 2001 From: Vincent Augagneur Date: Tue, 6 Aug 2013 11:40:03 +0200 Subject: [PATCH] //added active field on carrier wizard --- .../controllers/carrier_wizard/summary.tpl | 57 ++++++++++--------- .../admin/AdminCarrierWizardController.php | 50 ++++++++++++++-- css/admin.css | 3 +- 3 files changed, 79 insertions(+), 31 deletions(-) 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 82ee5d4ef..2e0b782a4 100644 --- a/admin-dev/themes/default/template/controllers/carrier_wizard/summary.tpl +++ b/admin-dev/themes/default/template/controllers/carrier_wizard/summary.tpl @@ -36,30 +36,35 @@ var summary_translation_price = '{l s='according to the price' js=1}'; var summary_translation_weight = '{l s='according to the weight' js=1}'; +
+
+ {l s='Carrier name:'} +
 
+
+
 
+
+
 
+
+
 
+
+ {l s='It will be displayed only for the following zones:'} +
    +
    +
     
    +
    + {l s='It will be displayed only for the following groups:'} +
      +
      + {if $is_multishop} +
       
      +
      + {l s='It will be displayed only for the following shops:'} +
        +
        + {/if} +
         
        + {$active_form} +
        +
        +
         
        -
        - {l s='Carrier name:'} -
         
        -
        -
         
        -
        -
         
        -
        -
         
        -
        - {l s='It will be displayed only for the following zones:'} -
          -
          -
           
          -
          - {l s='It will be displayed only for the following groups:'} -
            -
            - {if $is_multishop} -
             
            -
            - {l s='It will be displayed only for the following shops:'} -
              -
              - {/if} -
              diff --git a/controllers/admin/AdminCarrierWizardController.php b/controllers/admin/AdminCarrierWizardController.php index a8709bad5..392572662 100644 --- a/controllers/admin/AdminCarrierWizardController.php +++ b/controllers/admin/AdminCarrierWizardController.php @@ -114,7 +114,7 @@ class AdminCarrierWizardControllerCore extends AdminController 0 => $this->renderStepOne($carrier), 1 => $this->renderStepThree($carrier), 2 => $this->renderStepFour($carrier), - 3 => $this->renderStepFive(), + 3 => $this->renderStepFive($carrier), )), 'labels' => array('next' => $this->l('Next'), 'previous' => $this->l('Previous'), 'finish' => $this->l('Finish')) ); @@ -411,9 +411,47 @@ class AdminCarrierWizardControllerCore extends AdminController return $this->renderGenericForm(array('form' => $this->fields_form), $fields_value); } - public function renderStepFive() + public function renderStepFive($carrier) { - return $this->context->smarty->fetch('controllers/carrier_wizard/summary.tpl'); + $this->fields_form = array( + 'form' => array( + 'id_form' => 'step_carrier_summary', + 'input' => array( + array( + 'type' => 'radio', + 'label' => $this->l('Status:'), + 'name' => 'active', + 'required' => false, + 'class' => 't', + 'is_bool' => true, + 'values' => array( + array( + 'id' => 'active_on', + 'value' => 1, + 'label' => $this->l('Enabled') + ), + array( + 'id' => 'active_off', + 'value' => 0, + 'label' => $this->l('Disabled') + ) + ), + 'desc' => $this->l('Enable the carrier in the Front Office') + ) + ) + )); + + $template = $this->createTemplate('controllers/carrier_wizard/summary.tpl'); + + $fields_value = $this->getStepFiveFieldsValues($carrier); + + $active_form = $this->renderGenericForm(array('form' => $this->fields_form), $fields_value); + + $active_form = str_replace(array('
              ', '
              '), '', $active_form); + + $template->assign('active_form', $active_form); + + return $template->fetch('controllers/carrier_wizard/summary.tpl'); } protected function getTplRangesVarsAndValues($carrier, &$tpl_vars, &$fields_value) @@ -516,7 +554,7 @@ class AdminCarrierWizardControllerCore extends AdminController public function getStepFourFieldsValues($carrier) { return array( - 'range_behavior' => $this->getFieldValue($carrier, 'shop'), + 'range_behavior' => $this->getFieldValue($carrier, 'range_behavior'), 'max_height' => $this->getFieldValue($carrier, 'max_height'), 'max_width' => $this->getFieldValue($carrier, 'max_width'), 'max_depth' => $this->getFieldValue($carrier, 'max_depth'), @@ -525,6 +563,10 @@ class AdminCarrierWizardControllerCore extends AdminController ); } + public function getStepFiveFieldsValues($carrier) + { + return array('active' => $this->getFieldValue($carrier, 'active')); + } public function ajaxProcessChangeRanges() { diff --git a/css/admin.css b/css/admin.css index ed21adc82..c130d08d4 100644 --- a/css/admin.css +++ b/css/admin.css @@ -2631,7 +2631,8 @@ margin-bottom:7px; #carrier_wizard #zones_table input[type=text] {width: 45px;} #carrier_wizard #fieldset_form { min-height: 190px} #carrier_wizard #zone_ranges label { float: none; width: inherit } - +#carrier_wizard #step_carrier_summary label {width: 40px} +#carrier_wizard #step_carrier_summary .margin-form {padding-left: 60px;} /*** IE10 ***/ /*@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {