// Carrier Wizard summary (just started)

This commit is contained in:
Damien Metzger
2013-07-16 18:16:02 +02:00
parent 274b49bd81
commit de4cb8a096
4 changed files with 84 additions and 7 deletions
@@ -63,7 +63,7 @@
{foreach from=$zones key=i item=zone}
<tr class="fees {if $i is odd}alt_row{/if}" data-zoneid="{$zone.id_zone}">
<td>{$zone.name}</td>
<td class="zone"><input name="zone_{$zone.id_zone}" value="1" type="checkbox" {if isset($fields_value[$input.name][$zone.id_zone])} checked="checked"{/if}/></td>
<td class="zone"><input class="input_zone" name="zone_{$zone.id_zone}" value="1" type="checkbox" {if isset($fields_value[$input.name][$zone.id_zone])} checked="checked"{/if}/></td>
{foreach from=$ranges key=r item=range}
<td class="center"><input {if !isset($price_by_range[$range.id_range][$zone.id_zone])} disabled="disabled" {/if} name="fees[{$zone.id_zone}][]" type="text" value="{if isset($price_by_range[$range.id_range][$zone.id_zone])} {$price_by_range[$range.id_range][$zone.id_zone]|string_format:"%.6f"} {/if}" /></td>
{/foreach}
@@ -23,8 +23,35 @@
* International Registered Trademark & Property of PrestaShop SA
*}
<script type="text/javascript">
var summary_translation_undefined = '{l s='[undefined]' js='1'}';
var summary_translation_meta_informations = '{l s='This carrier is @s1 and display to the customers the following delay: @s2.' js='1'}';
var summary_translation_free = '<strong>{l s='free' js='1'}</strong>';
var summary_translation_paid = '<strong>{l s='paid' js='1'}</strong>';
var summary_translation_range = '{l s='This carrier can deliver orders from @s1 to @s2. If the order is out of range, the behavior is to @s3.' js='1'}';
var summary_translation_shipping_cost = '{l s='The shipping cost is calculated @s1 and the tax rule @s2 is applied.' js='1'}';
var summary_translation_price = '<strong>{l s='according to the price' js='1'}</strong>';
var summary_translation_weight = '<strong>{l s='according to the weight' js='1'}</strong>';
</script>
<fieldset>
<legend></legend>
</fieldset>
<legend>{l s='Summary'} - <span id="summary_name"></span></legend>
<div id="summary_meta_informations"></div>
<div class="clear">&nbsp;</div>
<div id="summary_shipping_cost"></div>
<div class="clear">&nbsp;</div>
<div id="summary_range"></div>
<div class="clear">&nbsp;</div>
<div>
{l s='It will be displayed only for the following zones:'}
<ul id="summary_zones"></ul>
</div>
<div class="clear">&nbsp;</div>
<div>
{l s='It will be displayed only for the following groups:'}
<ul id="summary_groups"></ul>
</div>
</fieldset>
@@ -229,12 +229,12 @@ class AdminCarrierWizardControllerCore extends AdminController
'class' => 't',
'values' => array(
array(
'id' => 'is_free_on',
'id' => 'is_free_off',
'value' => 0,
'label' => '<img src="../img/admin/enabled.gif" alt="'.$this->l('Yes').'" title="'.$this->l('Yes').'" />'
),
array(
'id' => 'is_free_off',
'id' => 'is_free_on',
'value' => 1,
'label' => '<img src="../img/admin/disabled.gif" alt="'.$this->l('No').'" title="'.$this->l('No').'" />'
)
+50
View File
@@ -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', '<strong>' + summary_translation_undefined + '</strong>'));
$('#summary_shipping_cost').html($('#summary_shipping_cost').html().replace('@s2', '<strong>' + $('#id_tax_rules_group option:selected').text() + '</strong>'));
// 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', '<strong>' + range_inf + '</strong>'));
$('#summary_range').html($('#summary_range').html().replace('@s2', '<strong>' + range_sup + '</strong>'));
$('#summary_range').html($('#summary_range').html().replace('@s3', '<strong>' + $('#range_behavior option:selected').text().toLowerCase() + '</strong>'));
// Delivery zones
$('#summary_zones').html('');
$('.input_zone').each(function(){
if ($(this).attr('checked'))
$('#summary_zones').html($('#summary_zones').html() + '<li><strong>' + $(this).parent().prev().text() + '</strong></li>');
});
// Group restrictions
$('#summary_groups').html('');
$('input[name$="groupBox[]"]').each(function(){
if ($(this).attr('checked'))
$('#summary_groups').html($('#summary_groups').html() + '<li><strong>' + $(this).parent().next().next().text() + '</strong></li>');
});
}
function validateSteps(step_number)