// MERGE with trunk revision 7754

This commit is contained in:
rMalie
2011-07-27 12:48:42 +00:00
parent 21017fb5d8
commit 233c0076b7
182 changed files with 6179 additions and 1333 deletions
+12 -1
View File
@@ -33,6 +33,17 @@ $cashOnDelivery = new CashOnDelivery();
if ($cart->id_customer == 0 OR $cart->id_address_delivery == 0 OR $cart->id_address_invoice == 0 OR !$cashOnDelivery->active)
Tools::redirect('index.php?controller=order&step=1');
// Check that this payment option is still available in case the customer changed his address just before the end of the checkout process
$authorized = false;
foreach (Module::getPaymentModules() as $module)
if ($module['name'] == 'cashondelivery')
{
$authorized = true;
break;
}
if (!$authorized)
die(Tools::displayError('This payment method is not available.'));
$customer = new Customer((int)$cart->id_customer);
if (!Validate::isLoadedObject($customer))
@@ -43,7 +54,7 @@ if (Tools::getValue('confirm'))
{
$customer = new Customer((int)$cart->id_customer);
$total = $cart->getOrderTotal(true, Cart::BOTH);
$cashOnDelivery->validateOrder((int)$cart->id, _PS_OS_PREPARATION_, $total, $cashOnDelivery->displayName, NULL, array(), NULL, false, $customer->secure_key);
$cashOnDelivery->validateOrder((int)$cart->id, Configuration::get('PS_OS_PREPARATION'), $total, $cashOnDelivery->displayName, NULL, array(), NULL, false, $customer->secure_key);
$order = new Order((int)$cashOnDelivery->currentOrder);
Tools::redirect('index.php?controller=order-confirmation&key='.$customer->secure_key.'&id_cart='.(int)($cart->id).'&id_module='.(int)$cashOnDelivery->id.'&id_order='.(int)$cashOnDelivery->currentOrder);
}