Ajout du module CustomDelivery v 1.0.7 (avant le AbstractDeliveryModuleWithState)
This commit is contained in:
@@ -0,0 +1,195 @@
|
||||
<!-- Configuration -->
|
||||
<div class="general-block-decorator">
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-12 title title-without-tabs">
|
||||
{intl d='customdelivery.bo.default' l='Configuration.'}
|
||||
</div>
|
||||
|
||||
<div class="form-container">
|
||||
<div class="col-md-12">
|
||||
|
||||
{form name="customdelivery.configuration.form"}
|
||||
<form method="POST" id="customdelivery-form" action="{url path="/admin/module/customdelivery/configuration"}" {form_enctype form=$form} class="clearfix">
|
||||
|
||||
{if $form_error_message}<div class="alert alert-danger">{$form_error_message}</div>{/if}
|
||||
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
{render_form_field form=$form field="url"}
|
||||
{render_form_field form=$form field="method"}
|
||||
|
||||
{form_field form=$form field="tax"}
|
||||
<div class="form-group {if $error}has-error{/if}">
|
||||
<label for="{$label_attr.for}" class="control-label">{$label} : </label>
|
||||
|
||||
<select id="{$label_attr.for}" name="{$name}" class="form-control">
|
||||
<option value="" {if $value == 0}selected="selected"{/if}>{intl l="No taxes" d="customdelivery.bo.default"}</option>
|
||||
{loop name='tax-rule-admin' type="tax-rule" backend_context="on"}
|
||||
<option value="{$ID}" {if $value == $ID}selected="selected"{/if}>{$ID}: {$TITLE}</option>
|
||||
{/loop}
|
||||
</select>
|
||||
</div>
|
||||
{/form_field}
|
||||
|
||||
<button type="submit" id="vpg-save" name="customdelivery_save" value="save" class="form-submit-button btn btn-sm btn-default" title="{intl d='customdelivery.bo.default' l='Save'}">{intl d='virtualproductgereso.ai' l='Save'}</button>
|
||||
|
||||
</form>
|
||||
{/form}
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- slices -->
|
||||
{* default currency *}
|
||||
{loop type="currency" name="default_currency" default_only="1"}
|
||||
{$currencySymbol=$SYMBOL}
|
||||
{/loop}
|
||||
|
||||
|
||||
<div class="general-block-decorator">
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-12 title title-without-tabs">
|
||||
{intl d='customdelivery.bo.default' l='Slices.'}
|
||||
</div>
|
||||
|
||||
<div id="slices" class="form-container">
|
||||
|
||||
{loop type="area" name="area" module_id=$module_id backend_context=true}
|
||||
{$area_id=$ID}
|
||||
<div class="col-md-12">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-condensed table-left-aligned">
|
||||
<caption class="clearfix">
|
||||
<small>{intl d='customdelivery.bo.default' l="Area : "}</small> {$NAME}
|
||||
</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
{if $method != 2}<th class="col-md-3">{intl d='customdelivery.bo.default' l="Untaxed Price up to ... %symbol" symbol=$currencySymbol}</th>{/if}
|
||||
{if $method != 1}<th class="col-md-3">{intl d='customdelivery.bo.default' l="Weight up to ... kg"}</th>{/if}
|
||||
<th class="col-md-5">{intl d='customdelivery.bo.default' l="Price (%symbol)" symbol=$currencySymbol}</th>
|
||||
<th class="col-md-1">{intl d='customdelivery.bo.default' l="Actions"}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{loop type="custom-delivery-slice" name="custom-delivery-slice" area_id=$area_id order="weight_max,price_max" }
|
||||
<tr class="js-slice" data-area="{$area_id}" data-id="{$ID}">
|
||||
{if $method != 2}
|
||||
<th class="col-md-3">
|
||||
<input type="text" data-field="price-max" class="form-control js-slice-price-max" value="{$PRICE_MAX}" data-old="{$PRICE_MAX}" />
|
||||
</th>
|
||||
{/if}
|
||||
{if $method != 1}
|
||||
<th class="col-md-3">
|
||||
<input type="text" data-field="weight-max" class="form-control js-slice-weight-max" value="{$WEIGHT_MAX}" data-old="{$WEIGHT_MAX}" />
|
||||
</th>
|
||||
{/if}
|
||||
<th class="col-md-5">
|
||||
<input type="text" data-field="price" class="form-control js-slice-price" value="{$PRICE}" data-old="{$PRICE}" />
|
||||
</th>
|
||||
<th class="col-md-1">
|
||||
<div class="btn-group">
|
||||
{loop type="auth" name="can_change" role="ADMIN" module="customdelivery" access="UPDATE"}
|
||||
<a class="btn btn-default btn-xs js-slice-save" title="{intl d='customdelivery.bo.default' l='Save this price slice'}">
|
||||
<span class="glyphicon glyphicon-floppy-disk"></span>
|
||||
</a>
|
||||
{/loop}
|
||||
{loop type="auth" name="can_change" role="ADMIN" module="customdelivery" access="DELETE"}
|
||||
<a class="btn btn-default btn-xs js-slice-delete" title="{intl d='customdelivery.bo.default' l='Delete this price slice'}" data-id="{$ID}">
|
||||
<span class="glyphicon glyphicon-trash"></span>
|
||||
</a>
|
||||
{/loop}
|
||||
</div>
|
||||
</th>
|
||||
</tr>
|
||||
{/loop}
|
||||
|
||||
{* New slice *}
|
||||
{loop type="auth" name="can_change" role="ADMIN" module="customdelivery" access="CREATE"}
|
||||
<tr class="js-slice-new" data-area="{$area_id}" data-id="0">
|
||||
{if $method != 2}
|
||||
<th class="col-md-3">
|
||||
<input type="text" data-field="price-max" class="form-control js-slice-price-max" value="" />
|
||||
</th>
|
||||
{/if}
|
||||
{if $method != 1}
|
||||
<th class="col-md-3">
|
||||
<input type="text" data-field="weight-max" class="form-control js-slice-weight-max" value="" />
|
||||
</th>
|
||||
{/if}
|
||||
<th class="col-md-5">
|
||||
<input type="text" data-field="price" class="form-control js-slice-price" value="" />
|
||||
</th>
|
||||
<th class="col-md-1">
|
||||
<a class="btn btn-default btn-xs js-slice-add" title="{intl d='customdelivery.bo.default' l='Add this price slice'}" >
|
||||
<span class="glyphicon glyphicon-plus"></span>
|
||||
</a>
|
||||
</th>
|
||||
</tr>
|
||||
{/loop}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/loop}
|
||||
{elseloop rel="area"}
|
||||
<div class="col-md-12">
|
||||
<div class="alert alert-warning">
|
||||
{intl d='customdelivery.bo.default' l="You should first attribute shipping zones to the modules: "}
|
||||
<a href="{url path="/admin/configuration/shipping_zones/update/$module_id"}">
|
||||
{intl d='customdelivery.bo.default' l="manage shipping zones"}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{/elseloop}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{include
|
||||
file = "includes/generic-warning-dialog.html"
|
||||
|
||||
dialog_id = "custom_delivery_dialog"
|
||||
dialog_title = {intl d='customdelivery.bo.default' l="Message"}
|
||||
dialog_body = ""
|
||||
}
|
||||
|
||||
{* JS Templates *}
|
||||
<script id="tpl-slice" type="text/html">
|
||||
<tr class="js-slice" data-area="<%=areaId %>" data-id="<%=id %>">
|
||||
{if $method != 2}
|
||||
<th class="col-md-3">
|
||||
<input type="text" data-field="price-max" class="form-control js-slice-price-max" value="<%=priceMax %>" data-old="<%=priceMax %>" />
|
||||
</th>
|
||||
{/if}
|
||||
{if $method != 1}
|
||||
<th class="col-md-3">
|
||||
<input type="text" data-field="weight-max" class="form-control js-slice-weight-max" value="<%=weightMax %>" data-old="<%=weightMax %>" />
|
||||
</th>
|
||||
{/if}
|
||||
<th class="col-md-5">
|
||||
<input type="text" data-field="price" class="form-control js-slice-price" value="<%=price %>" data-old="<%=price %>" />
|
||||
</th>
|
||||
<th class="col-md-1">
|
||||
<div class="btn-group">
|
||||
{loop type="auth" name="can_change" role="ADMIN" module="customdelivery" access="UPDATE"}
|
||||
<a class="btn btn-default btn-xs js-slice-save" title="{intl d='customdelivery.bo.default' l='Save this price slice'}">
|
||||
<span class="glyphicon glyphicon-floppy-disk"></span>
|
||||
</a>
|
||||
{/loop}
|
||||
{loop type="auth" name="can_change" role="ADMIN" module="customdelivery" access="DELETE"}
|
||||
<a class="btn btn-default btn-xs js-slice-delete" title="{intl d='customdelivery.bo.default' l='Delete this price slice'}" data-id="<%=id %>">
|
||||
<span class="glyphicon glyphicon-trash"></span>
|
||||
</a>
|
||||
{/loop}
|
||||
</div>
|
||||
</th>
|
||||
</tr>
|
||||
</script>
|
||||
@@ -0,0 +1,127 @@
|
||||
|
||||
{javascripts file='assets/js/libs/underscore-min.js'}
|
||||
<script src="{$asset_url}"></script>
|
||||
{/javascripts}
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
(function ($) {
|
||||
|
||||
var config = {
|
||||
'urlAdd': '{url path="/admin/module/customdelivery/save"}',
|
||||
'urlDelete': '{url path="/admin/module/customdelivery/delete"}',
|
||||
'urlSave': '{url path="/admin/module/customdelivery/save"}'
|
||||
};
|
||||
|
||||
{literal}
|
||||
$(document).ready(function () {
|
||||
|
||||
var tpl = _.template($("#tpl-slice").html());
|
||||
|
||||
var showMessage = function showMessage(message) {
|
||||
$('#custom_delivery_dialog')
|
||||
.find('.modal-body')
|
||||
.html(message)
|
||||
.end()
|
||||
.modal("show");
|
||||
};
|
||||
|
||||
var getSliceData = function getSliceData($slice) {
|
||||
var data = {
|
||||
id: $slice.data("id"),
|
||||
area: $slice.data("area"),
|
||||
price: $slice.find(".js-slice-price").first().val(),
|
||||
priceMax: $slice.find(".js-slice-price-max").first().val(),
|
||||
weightMax: $slice.find(".js-slice-weight-max").first().val()
|
||||
};
|
||||
|
||||
return data;
|
||||
};
|
||||
|
||||
// add new slice
|
||||
$('.js-slice-add').on('click', function(){
|
||||
var $slice = $(this).parents('tr').first();
|
||||
var data = getSliceData($slice);
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
dataType: 'json',
|
||||
data: data,
|
||||
url: config.urlAdd
|
||||
}).done(function(data, textStatus, jqXHR){
|
||||
var sliceHtml = '';
|
||||
if (data.success) {
|
||||
// reset form
|
||||
$slice.find('input').val('');
|
||||
// add slice
|
||||
sliceHtml = tpl(data.slice);
|
||||
|
||||
$(sliceHtml).insertBefore($slice);
|
||||
} else {
|
||||
showMessage(data.message.join('<br>'));
|
||||
}
|
||||
}).fail(function(jqXHR, textStatus, errorThrown){
|
||||
showMessage(textStatus);
|
||||
});
|
||||
});
|
||||
|
||||
// save new slice
|
||||
$('#slices').on('click', '.js-slice-save', function(){
|
||||
var $slice = $(this).parents('tr').first();
|
||||
var data = getSliceData($slice);
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
dataType: 'json',
|
||||
data: data,
|
||||
url: config.urlAdd
|
||||
}).done(function(data, textStatus, jqXHR){
|
||||
if (!data.success) {
|
||||
showMessage(data.message.join('<br>'));
|
||||
} else {
|
||||
var sliceHtml = tpl(data.slice);
|
||||
$(sliceHtml).insertBefore($slice);
|
||||
$slice.remove();
|
||||
// $slice.find('.js-slice-save').removeClass('btn-success');
|
||||
}
|
||||
}).fail(function(jqXHR, textStatus, errorThrown){
|
||||
showMessage(textStatus);
|
||||
});
|
||||
});
|
||||
|
||||
$('#slices').on('change', '.js-slice input', function() {
|
||||
$(this).parents('tr').first().find('.js-slice-save').addClass('btn-success');
|
||||
});
|
||||
|
||||
// delete new slice
|
||||
$('#slices').on('click', '.js-slice-delete', function(){
|
||||
var $slice = $(this).parents('tr').first();
|
||||
var data = getSliceData($slice);
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
dataType: 'json',
|
||||
data: data,
|
||||
url: config.urlDelete
|
||||
}).done(function(data, textStatus, jqXHR){
|
||||
var sliceHtml = '';
|
||||
if (data.success) {
|
||||
$slice.remove();
|
||||
} else {
|
||||
showMessage(data.message);
|
||||
}
|
||||
}).fail(function(jqXHR, textStatus, errorThrown){
|
||||
showMessage(textStatus);
|
||||
});
|
||||
});
|
||||
|
||||
// add new slice
|
||||
$('.js-slice input').on('change', function(){
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
{/literal}
|
||||
})(jQuery);
|
||||
|
||||
</script>
|
||||
@@ -0,0 +1,17 @@
|
||||
{default_translation_domain domain="customdelivery.email.default"}
|
||||
|
||||
{loop type="customer" name="customer.order" current="false" id="$customer_id" backend_context="1"}
|
||||
<p>{intl l="Dear" } {$LASTNAME} {$FIRSTNAME},</p>
|
||||
{/loop}
|
||||
|
||||
<p>{intl l="Thank you for your order on our online store %store_name" store_name={config key="store_name"}}</p>
|
||||
<p>{intl l="Your order %order_ref dated %order_date has been shipped on %update_date" order_ref={$order_ref} order_date={format_date date=$order_date} update_date={format_date date=$update_date}}</p>
|
||||
{if $package}
|
||||
<p>{intl l="The tracking number for this delivery is: %package" package={$package}}</p>
|
||||
{if $tracking_url}
|
||||
<p>{intl l="Please check this URL to track your parcel : %tracking_url" tracking_url={$tracking_url}}</p>
|
||||
{/if}
|
||||
{/if}
|
||||
<p>{intl l="Feel free to contact us for any further information"}</p>
|
||||
|
||||
<p>{intl l="Best Regards."}</p>
|
||||
@@ -0,0 +1,18 @@
|
||||
{default_translation_domain domain="customdelivery.email.default"}
|
||||
|
||||
{loop type="customer" name="customer.order" current="false" id="$customer_id" backend_context="1"}
|
||||
{intl l="Dear" } {$LASTNAME} {$FIRSTNAME},
|
||||
{/loop}
|
||||
|
||||
{intl l="Thank you for your order on our online store %store_name" store_name={config key="store_name"}}
|
||||
|
||||
{intl l="Your order %order_ref dated %order_date has been shipped on %update_date" order_ref={$order_ref} order_date={format_date date=$order_date} update_date={format_date date=$update_date}}
|
||||
{if $package}
|
||||
{intl l="The tracking number for this delivery is: %package" package={$package}}
|
||||
{if $tracking_url}
|
||||
{intl l="Please check this URL to track your parcel : %tracking_url" tracking_url={$tracking_url}}
|
||||
{/if}
|
||||
{/if}
|
||||
{intl l="Feel free to contact us for any further information"}
|
||||
|
||||
{intl l="Best Regards."}
|
||||
Reference in New Issue
Block a user