// BugFix with opc and multishipping
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@10330 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -273,7 +273,7 @@ class AuthControllerCore extends FrontController
|
||||
if (Configuration::get('PS_CART_FOLLOWING') && (empty($this->context->cookie->id_cart) || Cart::getNbProducts($this->context->cookie->id_cart) == 0))
|
||||
$this->context->cookie->id_cart = (int)Cart::lastNoneOrderedCart($this->context->customer->id);
|
||||
// Update cart address
|
||||
$this->context->cart->id_carrier = 0;
|
||||
$this->context->cart->delivery_option = '';
|
||||
$this->context->cart->id_address_delivery = Address::getFirstCustomerAddressId((int)($customer->id));
|
||||
$this->context->cart->id_address_invoice = Address::getFirstCustomerAddressId((int)($customer->id));
|
||||
$this->context->cart->update();
|
||||
|
||||
@@ -104,7 +104,7 @@ class CartControllerCore extends FrontController
|
||||
{
|
||||
if (!Cart::getNbProducts((int)($this->context->cart->id)))
|
||||
{
|
||||
$this->context->cart->id_carrier = 0;
|
||||
$this->context->cart->delivery_option = '';
|
||||
$this->context->cart->gift = 0;
|
||||
$this->context->cart->gift_message = '';
|
||||
$this->context->cart->update();
|
||||
@@ -248,7 +248,7 @@ class CartControllerCore extends FrontController
|
||||
$deliveryAddress = new Address($this->context->cart->id_address_delivery);
|
||||
$id_country = (isset($deliveryAddress) && $deliveryAddress->id) ? $deliveryAddress->id_country : Configuration::get('PS_COUNTRY_DEFAULT');
|
||||
$result['carriers'] = Carrier::getCarriersForOrder(Country::getIdZone($id_country), $groups);
|
||||
$result['checked'] = Carrier::getDefaultCarrierSelection($result['carriers'], (int)$this->cart->id_carrier);
|
||||
//$result['checked'] = Carrier::getDefaultCarrierSelection($result['carriers'], (int)$this->cart->id_carrier);
|
||||
}
|
||||
$result['summary'] = $this->context->cart->getSummaryDetails();
|
||||
$result['customizedDatas'] = Product::getAllCustomizedDatas($this->context->cart->id, null, true);
|
||||
|
||||
@@ -190,7 +190,7 @@ class OrderControllerCore extends ParentOrderController
|
||||
unset($this->context->cart->id_address_invoice);
|
||||
Tools::redirect('index.php?controller=order&step=1');
|
||||
}
|
||||
else if ($this->step >= 3 && !$this->context->cart->id_carrier && !$isVirtualCart)
|
||||
else if ($this->step >= 3 && !$this->context->cart->delivery_option && !$isVirtualCart)
|
||||
Tools::redirect('index.php?controller=order&step=2');
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ class OrderOpcControllerCore extends ParentOrderController
|
||||
}
|
||||
break;
|
||||
case 'updateCarrierAndGetPayments':
|
||||
if (Tools::isSubmit('id_carrier') AND Tools::isSubmit('recyclable') AND Tools::isSubmit('gift') AND Tools::isSubmit('gift_message'))
|
||||
if (Tools::isSubmit('delivery_option') AND Tools::isSubmit('recyclable') AND Tools::isSubmit('gift') AND Tools::isSubmit('gift_message'))
|
||||
{
|
||||
if ($this->_processCarrier())
|
||||
{
|
||||
@@ -343,7 +343,7 @@ class OrderOpcControllerCore extends ParentOrderController
|
||||
protected function _assignPayment()
|
||||
{
|
||||
$this->context->smarty->assign(array(
|
||||
'HOOK_TOP_PAYMENT' => ($this->isLogged ? Hook::exec('paymentTop') : ''),
|
||||
'HOOK_TOP_PAYMENT' => ($this->isLogged ? Hook::exec('paymentTop') : ''),
|
||||
'HOOK_PAYMENT' => $this->_getPaymentMethods()
|
||||
));
|
||||
}
|
||||
@@ -360,14 +360,8 @@ class OrderOpcControllerCore extends ParentOrderController
|
||||
$address_invoice = ($this->context->cart->id_address_delivery == $this->context->cart->id_address_invoice ? $address_delivery : new Address($this->context->cart->id_address_invoice));
|
||||
if (!$this->context->cart->id_address_delivery OR !$this->context->cart->id_address_invoice OR !Validate::isLoadedObject($address_delivery) OR !Validate::isLoadedObject($address_invoice) OR $address_invoice->deleted OR $address_delivery->deleted)
|
||||
return '<p class="warning">'.Tools::displayError('Error: please choose an address').'</p>';
|
||||
if (!$this->context->cart->id_carrier AND !$this->context->cart->isVirtualCart())
|
||||
if (!$this->context->cart->delivery_option AND !$this->context->cart->isVirtualCart())
|
||||
return '<p class="warning">'.Tools::displayError('Error: please choose a carrier').'</p>';
|
||||
elseif ($this->context->cart->id_carrier != 0)
|
||||
{
|
||||
$carrier = new Carrier((int)($this->context->cart->id_carrier));
|
||||
if (!Validate::isLoadedObject($carrier) OR $carrier->deleted OR !$carrier->active)
|
||||
return '<p class="warning">'.Tools::displayError('Error: the carrier is invalid').'</p>';
|
||||
}
|
||||
if (!$this->context->cart->id_currency)
|
||||
return '<p class="warning">'.Tools::displayError('Error: no currency has been selected').'</p>';
|
||||
if (!$this->context->cookie->checkedTOS AND Configuration::get('PS_CONDITIONS'))
|
||||
|
||||
@@ -227,6 +227,8 @@ class ParentOrderControllerCore extends FrontController
|
||||
|
||||
// Carrier has changed, so we check if the cart rules still apply
|
||||
CartRule::autoRemoveFromCart();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -247,8 +249,6 @@ class ParentOrderControllerCore extends FrontController
|
||||
|
||||
protected function _assignSummaryInformations()
|
||||
{
|
||||
if (file_exists(_PS_SHIP_IMG_DIR_.$this->context->cart->id_carrier.'.jpg'))
|
||||
$this->context->smarty->assign('carrierPicture', 1);
|
||||
$summary = $this->context->cart->getSummaryDetails();
|
||||
$customizedDatas = Product::getAllCustomizedDatas($this->context->cart->id);
|
||||
|
||||
@@ -435,13 +435,15 @@ class ParentOrderControllerCore extends FrontController
|
||||
*/
|
||||
protected function setNoCarrier()
|
||||
{
|
||||
$this->context->cart->id_carrier = 0;
|
||||
$this->context->cart->delivery_option = 0;
|
||||
$this->context->cart->update();
|
||||
}
|
||||
|
||||
/**
|
||||
* Decides what the default carrier is and update the cart with it
|
||||
*
|
||||
* @todo this function must be modified - id_carrier is now delivery_option
|
||||
*
|
||||
* @param array $carriers
|
||||
* @return number the id of the default carrier
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user