[+] BO : Product "For" and new carriers select list
This commit is contained in:
@@ -81,26 +81,31 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<label class="control-label col-lg-5" for="carriers_restriction">
|
<label class="control-label col-lg-5" for="availableCarriers">{l s='Carriers:'}</label>
|
||||||
<span class="label-tooltip" data-toggle="tooltip"
|
<div class="input-group col-lg-7">
|
||||||
title="{l s='If no carrier selected, all carriers can be used to ship this product.'}">
|
<div class="row">
|
||||||
{l s='Carriers:'}
|
<div class="col-lg-6">
|
||||||
</span>
|
<label for="availableCarriers">{l s='Available carriers'}</label>
|
||||||
|
<select multiple id="availableCarriers" name="availableCarriers">
|
||||||
</label>
|
{foreach $carrier_list as $carrier}
|
||||||
<div class="col-lg-3">
|
{if !isset($carrier.selected) || !$carrier.selected}
|
||||||
<select name="carriers[]" id="carriers_restriction" multiple="multiple">
|
<option value="{$carrier.id_reference}">{$carrier.name}</option>
|
||||||
{foreach $carrier_list as $carrier}
|
{/if}
|
||||||
<option value="{$carrier.id_reference}" {if isset($carrier.selected) && $carrier.selected}selected="selected"{/if}>{$carrier.name}</option>
|
{/foreach}
|
||||||
{/foreach}
|
</select>
|
||||||
</select>
|
<a href="#" id="addCarrier" class="btn btn-default btn-block">{l s='Add'} <i class="icon-arrow-right"></i></a>
|
||||||
<button class="btn btn-default" onclick="unselectAllCarriers(); return false;">{l s='Unselect all'}</button>
|
</div>
|
||||||
|
<div class="col-lg-6">
|
||||||
|
<label for="selectedCarriers">{l s='Selected carriers'}</label>
|
||||||
|
<select multiple id="selectedCarriers" name="selectedCarriers[]">
|
||||||
|
{foreach $carrier_list as $carrier}
|
||||||
|
{if isset($carrier.selected) && $carrier.selected}
|
||||||
|
<option value="{$carrier.id_reference}">{$carrier.name}</option>
|
||||||
|
{/if}
|
||||||
|
{/foreach}
|
||||||
|
</select>
|
||||||
|
<a href="#" id="removeCarrier" class="btn btn-default btn-block"><i class="icon-arrow-left"></i> {l s='Remove'}</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
|
||||||
function unselectAllCarriers()
|
|
||||||
{ $('#carriers_restriction option').each(function () { $(this).removeAttr('selected')});
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -3603,8 +3603,9 @@ class AdminProductsControllerCore extends AdminController
|
|||||||
{
|
{
|
||||||
$carriers = array();
|
$carriers = array();
|
||||||
|
|
||||||
if (Tools::getValue('carriers'))
|
if (Tools::getValue('selectedCarriers'))
|
||||||
$carriers = Tools::getValue('carriers');
|
$carriers = Tools::getValue('selectedCarriers');
|
||||||
|
|
||||||
$product->setCarriers($carriers);
|
$product->setCarriers($carriers);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -760,6 +760,32 @@ product_tabs['Attachments'] = new function(){
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
product_tabs['Shipping'] = new function(){
|
||||||
|
var self = this;
|
||||||
|
|
||||||
|
this.bindCarriersEvents = function (){
|
||||||
|
$("#addCarrier").live('click', function() {
|
||||||
|
$('#availableCarriers option:selected').each( function() {
|
||||||
|
$('#selectedCarriers').append("<option value='"+$(this).val()+"'>"+$(this).text()+"</option>");
|
||||||
|
$(this).remove();
|
||||||
|
});
|
||||||
|
$('#selectedCarriers option').prop('selected', true);
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#removeCarrier").live('click', function() {
|
||||||
|
$('#selectedCarriers option:selected').each( function() {
|
||||||
|
$('#availableCarriers').append("<option value='"+$(this).val()+"'>"+$(this).text()+"</option>");
|
||||||
|
$(this).remove();
|
||||||
|
});
|
||||||
|
$('#selectedCarriers option').prop('selected', true);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
this.onReady = function(){
|
||||||
|
self.bindCarriersEvents();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
product_tabs['Informations'] = new function(){
|
product_tabs['Informations'] = new function(){
|
||||||
var self = this;
|
var self = this;
|
||||||
this.bindAvailableForOrder = function (){
|
this.bindAvailableForOrder = function (){
|
||||||
|
|||||||
Reference in New Issue
Block a user