//carrier wizard first step

This commit is contained in:
Vincent Augagneur
2013-07-03 16:10:23 +02:00
parent 9eeaf524c5
commit 943eacdf75
5 changed files with 158 additions and 48 deletions
@@ -24,57 +24,34 @@
*}
{extends file="helpers/view/view.tpl"}
{block name="override_tpl"}
<script>
$(document).ready(function () {
$('#carrier_wizard').smartWizard();
$("#carrier_wizard").smartWizard({
'labelNext' : '{$labels.next}',
'labelPrevious' : '{$labels.previous}',
'labelFinish' : '{$labels.finish}'
});
});
</script>
<div id="carrier_wizard" class="swMain">
<ul>
<li>
<a href="#step-1">
<label class="stepNumber">1</label>
<span class="stepDesc">Step 1<br /><small>Step 1 description</small></span>
</a>
</li>
<li>
<a href="#step-2">
<label class="stepNumber">2</label>
<span class="stepDesc">Step 2<br /><small>Step 2 description</small></span>
</a>
</li>
<li>
<a href="#step-3">
<label class="stepNumber">3</label>
<span class="stepDesc">Step 3<br /><small>Step 3 description</small></span>
</a>
</li>
<li>
<a href="#step-4">
<label class="stepNumber">4</label>
<span class="stepDesc">Step 4<br /><small>Step 4 description</small></span>
</a>
</li>
</ul>
<div id="step-1">
<h2 class="StepTitle">Step 1 Content</h2>
<!-- step content -->
</div>
<div id="step-2">
<h2 class="StepTitle">Step 2 Content</h2>
<!-- step content -->
</div>
<div id="step-3">
<h2 class="StepTitle">Step 3 Title</h2>
<!-- step content -->
</div>
<div id="step-4">
<h2 class="StepTitle">Step 4 Title</h2>
<!-- step content -->
</div>
<ul>
{foreach from=$wizard_steps.steps key=step_nbr item=step}
<li>
<a href="#step-{$step_nbr + 1}">
<label class="stepNumber">{$step_nbr + 1}</label>
<span class="stepDesc">
{$step.title}<br />
{if isset($step.desc)}<small>{$step.desc}</small>{/if}
</span>
</a>
</li>
{/foreach}
</ul>
{foreach from=$wizard_contents.contents key=step_nbr item=content}
<div id="step-{$step_nbr + 1}">
{$content}
</div>
{/foreach}
</div>
{/block}
+1 -1
View File
@@ -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)
@@ -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'),
);
}
}
@@ -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;
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB