// Multishipping button is replaced by a checkbox

// BugFix with back params in the checkout process
This commit is contained in:
mDeflotte
2011-12-06 14:56:29 +00:00
parent 9d0bf47084
commit 8adff9fb5b
5 changed files with 39 additions and 36 deletions
+9 -3
View File
@@ -116,6 +116,11 @@ class AuthControllerCore extends FrontController
if (Tools::getValue('create_account'))
$this->context->smarty->assign('email_create', 1);
if (Tools::getValue('multi-shipping') == 1)
$this->context->smarty->assign('multi_shipping', true);
else
$this->context->smarty->assign('multi_shipping', false);
$this->assignAddressFormat();
// Call a hook to display more information on form
@@ -296,6 +301,7 @@ class AuthControllerCore extends FrontController
$this->context->cart->id_address_invoice = Address::getFirstCustomerAddressId((int)($customer->id));
$this->context->cart->secure_key = $customer->secure_key;
$this->context->cart->update();
// Add customer to the context
$this->context->customer = $customer;
@@ -307,7 +313,7 @@ class AuthControllerCore extends FrontController
if (!$this->ajax)
{
if ($back = Tools::getValue('back'))
Tools::redirect($back);
Tools::redirect(html_entity_decode($back));
Tools::redirect('index.php?controller=my-account');
}
}
@@ -404,7 +410,7 @@ class AuthControllerCore extends FrontController
}
// redirection: if cart is not empty : redirection to the cart
if (count($this->context->cart->getProducts(true)) > 0)
Tools::redirect('index.php?controller=order');
Tools::redirect('index.php?controller=order&multi-shipping='.(int)Tools::getValue('multi-shipping'));
// else : redirection to the account
else
Tools::redirect('index.php?controller=my-account');
@@ -545,7 +551,7 @@ class AuthControllerCore extends FrontController
Tools::redirect('index.php?controller=my-account');
// redirection: if cart is not empty : redirection to the cart
if (count($this->context->cart->getProducts(true)) > 0)
Tools::redirect('index.php?controller=order');
Tools::redirect('index.php?controller=order&multi-shipping='.(int)Tools::getValue('multi-shipping'));
// else : redirection to the account
else
Tools::redirect('index.php?controller=my-account');
+1 -1
View File
@@ -63,7 +63,7 @@ class OrderControllerCore extends ParentOrderController
}
if (!$this->context->customer->isLogged(true) && in_array($this->step, array(1, 2, 3)))
Tools::redirect('index.php?controller=authentication&back='.urlencode('order.php&step='.$this->step));
Tools::redirect('index.php?controller=authentication&back='.urlencode('order.php&step='.$this->step.'&multi-shipping='.(int)Tools::getValue('multi-shipping')).'&multi-shipping='.(int)Tools::getValue('multi-shipping'));
if (Tools::getValue('multi-shipping') == 1)
$this->context->smarty->assign('multi_shipping', true);
+1 -1
View File
@@ -325,7 +325,7 @@ class ParentOrderControllerCore extends FrontController
Tools::redirect('');
}
else if (!Customer::getAddressesTotalById($this->context->customer->id))
Tools::redirect('index.php?controller=address&back=order.php&step=1');
Tools::redirect('index.php?controller=address&back=order.php&step=1&multi-shipping='.(int)Tools::getValue('multi-shipping'));
$customer = $this->context->customer;
if (Validate::isLoadedObject($customer))
{
+11
View File
@@ -646,4 +646,15 @@ $(document).ready(function() {
});
$('#gift').checkboxChange(function() { $('#gift_div').show('slow'); }, function() { $('#gift_div').hide('slow'); });
$('#enable-multishipping').checkboxChange(
function() {
$('.standard-checkout').hide(0);
$('.multishipping-checkout').show(0);
},
function() {
$('.standard-checkout').show(0);
$('.multishipping-checkout').hide(0);
}
);
});
+17 -31
View File
@@ -321,34 +321,20 @@
</table>
</div>
{if !$cart->isAllProductsInStock()}
<p>
<input type="checkbox" name="allow_seperated_package" id="allow_seperated_package" {if $cart->allow_seperated_package}checked="checked"{/if} />
<label for="allow_seperated_package">{l s="Send the available products first"}</label>
</p>
{/if}
{if !$opc}
{if Configuration::get('PS_ALLOW_MULTISHIPPING')}
<p>
<input type="checkbox" {if $multi_shipping}checked="checked"{/if} id="enable-multishipping" />
<label for="enable-multishipping">{l s="I want to specify a delivery address for each products ordered."}</label>
</p>
{/if}
{/if}
<div id="HOOK_SHOPPING_CART">{$HOOK_SHOPPING_CART}</div>
@@ -415,9 +401,9 @@
{/if}
<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>
{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>
<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 standard-checkout" title="{l s='Next'}">{l s='Next'} &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 multishipping-checkout exclusive" title="{l s='Next'}">{l s='Next'} &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>