diff --git a/admin-dev/themes/default/template/controllers/carrier_wizard/helpers/view/view.tpl b/admin-dev/themes/default/template/controllers/carrier_wizard/helpers/view/view.tpl index da6ea6abc..38a2dd573 100644 --- a/admin-dev/themes/default/template/controllers/carrier_wizard/helpers/view/view.tpl +++ b/admin-dev/themes/default/template/controllers/carrier_wizard/helpers/view/view.tpl @@ -24,57 +24,34 @@ *} {extends file="helpers/view/view.tpl"} - {block name="override_tpl"} - -
- -
-

Step 1 Content

- -
-
-

Step 2 Content

- -
-
-

Step 3 Title

- -
-
-

Step 4 Title

- -
+ + {foreach from=$wizard_contents.contents key=step_nbr item=content} +
+ {$content} +
+ {/foreach}
{/block} diff --git a/classes/controller/AdminController.php b/classes/controller/AdminController.php index 597e75371..a8a33ca7a 100644 --- a/classes/controller/AdminController.php +++ b/classes/controller/AdminController.php @@ -2290,7 +2290,7 @@ class AdminControllerCore extends Controller * @return array */ public function getFieldsValue($obj) - { + { foreach ($this->fields_form as $fieldset) if (isset($fieldset['form']['input'])) foreach ($fieldset['form']['input'] as $input) diff --git a/controllers/admin/AdminCarrierWizardController.php b/controllers/admin/AdminCarrierWizardController.php index 40fff6e86..7de2276a1 100644 --- a/controllers/admin/AdminCarrierWizardController.php +++ b/controllers/admin/AdminCarrierWizardController.php @@ -38,9 +38,142 @@ class AdminCarrierWizardControllerCore extends AdminController $this->addJqueryPlugin('smartWizard'); } + public function initWizard() + { + $this->wizard_steps = array( + 'name' => 'carrier_wizard', + 'steps' => array( + array( + 'title' => $this->l('General'), + 'desc' => $this->l('General'), + ), + array( + 'title' => $this->l('Where and how much ?'), + 'desc' => $this->l('Where and how much ?'), + ), + array( + 'title' => $this->l('What and to who ?'), + 'desc' => $this->l('What and to who ?'), + ), + array( + 'title' => $this->l('Resume'), + 'desc' => $this->l('Resume'), + ), + + )); + + /* $this->wizard_steps */ + + + + if (Shop::isFeatureActive()) + { + $multistore_step = array( + array( + 'title' => $this->l('MultiStore'), + 'desc' => $this->l('MultiStore'), + ) + ); + array_splice($this->wizard_steps['steps'], 1, 0, $multistore_step); + } + } + public function renderView() { + $this->initWizard(); + + + $this->tpl_view_vars = array( + 'wizard_steps' => $this->wizard_steps, + 'wizard_contents' => array( + 'contents' => array( + 0 => $this->renderStepOne(), + )), + 'labels' => array('next' => $this->l('Next'), 'previous' => $this->l('Previous'), 'finish' => $this->l('Finish')) + ); + return parent::renderView(); } + + public function renderStepOne() + { + $fields_form = array( + 'form' => array( + 'legend' => array( + 'title' => $this->l('Carriers:'), + 'image' => '../img/admin/delivery.gif' + ), + 'input' => array( + array( + 'type' => 'text', + 'label' => $this->l('Company:'), + 'name' => 'name', + 'size' => 25, + 'required' => true, + 'hint' => sprintf($this->l('Allowed characters: letters, spaces and %s'), '().-'), + 'desc' => array( + $this->l('Carrier name displayed during checkout'), + $this->l('For in-store pickup, enter 0 to replace the carrier name with your shop name.') + ) + ), + array( + 'type' => 'file', + 'label' => $this->l('Logo:'), + 'name' => 'logo', + 'desc' => $this->l('Upload a logo from your computer.').' (.gif, .jpg, .jpeg '.$this->l('or').' .png)' + ), + array( + 'type' => 'text', + 'label' => $this->l('Transit time:'), + 'name' => 'delay', + 'lang' => true, + 'required' => true, + 'size' => 41, + 'maxlength' => 128, + 'desc' => $this->l('Estimated delivery time will be displayed during checkout.') + ), + array( + 'type' => 'text', + 'label' => $this->l('Speed Grade:'), + 'name' => 'grade', + 'required' => false, + 'size' => 1, + 'desc' => $this->l('Enter "0" for a longest shipping delay, or "9" for the shortest shipping delay.') + ), + array( + 'type' => 'text', + 'label' => $this->l('URL:'), + 'name' => 'url', + 'size' => 40, + 'desc' => $this->l('Delivery tracking URL: Type \'@\' where the tracking number should appear. It will then be automatically replaced by the tracking number.') + ), + )), + ); + + $helper = new HelperForm(); + $carrier = new Carrier(1); + + $helper->default_form_language = 1; + $helper->allow_employee_form_lang = 1; + $this->fields_form = array(); + $helper->tpl_vars = array( + 'fields_value' => $this->getStep1FieldsValues($carrier), + 'languages' => $this->getLanguages(), + 'id_language' => 1 + ); + return $helper->generateForm(array('form' => $fields_form)); + } + + public function getStep1FieldsValues($carrier) + { + return array( + 'name' => $this->getFieldsValue($carrier, 'name'), + 'logo' => '', + 'delay' => $this->getFieldsValue($carrier, 'delay'), + 'grade' => $this->getFieldsValue($carrier, 'grade'), + 'url' => $this->getFieldsValue($carrier, 'url'), + ); + + } } \ No newline at end of file diff --git a/js/jquery/plugins/smartWizard/jquery.smartWizard.css b/js/jquery/plugins/smartWizard/jquery.smartWizard.css index 8c6e844a1..edff8408f 100755 --- a/js/jquery/plugins/smartWizard/jquery.smartWizard.css +++ b/js/jquery/plugins/smartWizard/jquery.smartWizard.css @@ -261,7 +261,7 @@ border: 1px solid #FFD700; font: bold 13px Verdana, Arial, Helvetica, sans-serif; color:#5A5655; - background: #FFF url(../images/loader.gif) no-repeat 5px; + background: #FFF url(loader.gif) no-repeat 5px; -moz-border-radius : 5px; -webkit-border-radius: 5px; z-index:998; diff --git a/js/jquery/plugins/smartWizard/loader.gif b/js/jquery/plugins/smartWizard/loader.gif new file mode 100644 index 000000000..7e717cdf9 Binary files /dev/null and b/js/jquery/plugins/smartWizard/loader.gif differ