// Allow / Disallow multishipping

This commit is contained in:
mDeflotte
2011-12-01 16:34:20 +00:00
parent 660a595bf1
commit ab5edcd2d1
5 changed files with 51 additions and 26 deletions
@@ -165,6 +165,13 @@ class AdminPreferencesControllerCore extends AdminController
'list' => $order_process_type,
'identifier' => 'value'
),
'PS_ALLOW_MULTISHIPPING' => array(
'title' => $this->l('Allow multi-shipping'),
'desc' => $this->l('Allow the customer to ship is order to multiple addressed or in to deliver the products "in stock" first. This option will transform the customer cart in one or more orders.'),
'validation' => 'isBool',
'cast' => 'intval',
'type' => 'bool'
),
'PS_REGISTRATION_PROCESS_TYPE' => array(
'title' => $this->l('Registration process type'),
'desc' => $this->l('The "Only account creation" step register process allows the customer to register faster, and create his address later.'),
+9
View File
@@ -117,6 +117,9 @@ class CartControllerCore extends FrontController
protected function processChangeProductAddressDelivery()
{
if (!Configuration::get('PS_ALLOW_MULTISHIPPING'))
return;
$old_id_address_delivery = (int)Tools::getValue('old_id_address_delivery');
$new_id_address_delivery = (int)Tools::getValue('new_id_address_delivery');
@@ -129,6 +132,9 @@ class CartControllerCore extends FrontController
protected function processAllowSeperatedPackage()
{
if (!Configuration::get('PS_ALLOW_MULTISHIPPING'))
return;
if (Tools::getValue('value') === false)
die('{"error":true, "error_message": "No value setted"}');
@@ -139,6 +145,9 @@ class CartControllerCore extends FrontController
protected function processDuplicateProduct()
{
if (!Configuration::get('PS_ALLOW_MULTISHIPPING'))
return;
if (
!$this->context->cart->duplicateProduct(
$this->id_product,
+10 -5
View File
@@ -109,7 +109,8 @@ function changeAddressDelivery(obj)
updateHookShoppingCart(jsonData.HOOK_SHOPPING_CART);
updateHookShoppingCartExtra(jsonData.HOOK_SHOPPING_CART_EXTRA);
if (jsonData.carriers != null)
getCarrierListAndUpdate();
if (typeof(getCarrierListAndUpdate) != 'undefined')
getCarrierListAndUpdate();
// @todo reverse the remove order
// This effect remove the current line, but it's better to remove the other one, and refresshing this one
@@ -299,7 +300,8 @@ function deleteProductFromSummary(id)
updateHookShoppingCartExtra(jsonData.HOOK_SHOPPING_CART_EXTRA);
updateCustomizedDatas(jsonData.customizedDatas);
if (jsonData.carriers != null)
getCarrierListAndUpdate();
if (typeof(getCarrierListAndUpdate) != 'undefined')
getCarrierListAndUpdate();
}
},
error: function(XMLHttpRequest, textStatus, errorThrown) {alert("TECHNICAL ERROR: unable to save update quantity \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);}
@@ -349,7 +351,8 @@ function upQuantity(id, qty)
updateHookShoppingCart(jsonData.HOOK_SHOPPING_CART);
updateHookShoppingCartExtra(jsonData.HOOK_SHOPPING_CART_EXTRA);
if (jsonData.carriers != null)
getCarrierListAndUpdate();
if (typeof(getCarrierListAndUpdate) != 'undefined')
getCarrierListAndUpdate();
}
},
error: function(XMLHttpRequest, textStatus, errorThrown) {alert("TECHNICAL ERROR: unable to save update quantity \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);}
@@ -408,7 +411,8 @@ function downQuantity(id, qty)
updateHookShoppingCart(jsonData.HOOK_SHOPPING_CART);
updateHookShoppingCartExtra(jsonData.HOOK_SHOPPING_CART_EXTRA);
if (jsonData.carriers != null)
getCarrierListAndUpdate();
if (typeof(getCarrierListAndUpdate) != 'undefined')
getCarrierListAndUpdate();
}
},
error: function(XMLHttpRequest, textStatus, errorThrown) {alert("TECHNICAL ERROR: unable to save update quantity \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);}
@@ -635,7 +639,8 @@ $(document).ready(function() {
+'&token='+static_token,
success: function(jsonData)
{
getCarrierListAndUpdate();
if (typeof(getCarrierListAndUpdate) != 'undefined')
getCarrierListAndUpdate();
}
});
});
+22 -20
View File
@@ -164,7 +164,7 @@
{include file="$tpl_dir./order-steps.tpl"}
{include file="$tpl_dir./errors.tpl"}
{if !$multi_shipping}
{if !$multi_shipping && {Configuration::get('PS_ALLOW_MULTISHIPPING')}}
<div class="button_multishipping_mode" id="multishipping_mode_box">
<div class="title">{l s='Multi-shipping'}</div>
<div class="description">
@@ -176,26 +176,28 @@
{/if}
<form action="{$link->getPageLink($back_order_page, true)}" method="post">
{else}
<div class="address-form-multishipping">
<div class="button_multishipping_mode" id="multishipping_mode_box">
<div class="title">{l s='Multi-shipping'}</div>
<div class="description">
<input type="checkbox" id="multishipping_mode_checkbox" onchange="multishippingMode(this); return false;"/><label for="multishipping_mode_checkbox">{l s='I want to specify a delivery address for each products I order.'}</label>
{if {Configuration::get('PS_ALLOW_MULTISHIPPING')}}
<div class="address-form-multishipping">
<div class="button_multishipping_mode" id="multishipping_mode_box">
<div class="title">{l s='Multi-shipping'}</div>
<div class="description">
<input type="checkbox" id="multishipping_mode_checkbox" onchange="multishippingMode(this); return false;"/><label for="multishipping_mode_checkbox">{l s='I want to specify a delivery address for each products I order.'}</label>
</div>
<div class="description_off">
<a href="{$link->getPageLink('order-opc', true, NULL, 'ajax=1&multi-shipping=1&method=multishipping')}" id="link_multishipping_form" title="{l s='Choose the delivery addresses'}">
{l s='Specify a delivery address for each products.'}
</a>
</div>
</div>
<script type="text/javascript">
{if $is_multi_address_delivery}
var multishipping_mode = true;
{else}
var multishipping_mode = false;
{/if}
</script>
</div>
<div class="description_off">
<a href="{$link->getPageLink('order-opc', true, NULL, 'ajax=1&multi-shipping=1&method=multishipping')}" id="link_multishipping_form" title="{l s='Choose the delivery addresses'}">
{l s='Specify a delivery address for each products.'}
</a>
</div>
</div>
<script type="text/javascript">
{if $is_multi_address_delivery}
var multishipping_mode = true;
{else}
var multishipping_mode = false;
{/if}
</script>
</div>
{/if}
<div id="opc_account" class="opc-main-block">
<div id="opc_account-overlay" class="opc-overlay" style="display: none;"></div>
{/if}
+3 -1
View File
@@ -404,7 +404,9 @@
<p class="cart_navigation">
{if !$opc}
<a href="{if $back}{$link->getPageLink('order', true, NULL, 'step=1&amp;back={$back}')}{else}{$link->getPageLink('order', true, NULL, 'step=1')}{/if}" class="exclusive" title="{l s='Next'}">{l s='Next'} &raquo;</a>
<a href="{if $back}{$link->getPageLink('order', true, NULL, 'step=1&amp;back={$back}')}{else}{$link->getPageLink('order', true, NULL, 'step=1')}{/if}&amp;multi-shipping=1" class="multishipping-button exclusive" title="{l s='Multi-shipping'}">{l s='Multi-shipping'} &raquo;</a>
{if {Configuration::get('PS_ALLOW_MULTISHIPPING')}}
<a href="{if $back}{$link->getPageLink('order', true, NULL, 'step=1&amp;back={$back}')}{else}{$link->getPageLink('order', true, NULL, 'step=1')}{/if}&amp;multi-shipping=1" class="multishipping-button exclusive" title="{l s='Multi-shipping'}">{l s='Multi-shipping'} &raquo;</a>
{/if}
{/if}
<a href="{if (isset($smarty.server.HTTP_REFERER) && strstr($smarty.server.HTTP_REFERER, 'order.php')) || !isset($smarty.server.HTTP_REFERER)}{$link->getPageLink('index')}', {else}{$smarty.server.HTTP_REFERER|escape:'htmlall':'UTF-8'|secureReferrer}{/if}" class="button_large" title="{l s='Continue shopping'}">&laquo; {l s='Continue shopping'}</a>
</p>