// Merge -> revision 9061
This commit is contained in:
@@ -237,13 +237,15 @@ class CartControllerCore extends FrontController
|
||||
|
||||
if (Tools::getIsset('summary'))
|
||||
{
|
||||
$result = array();
|
||||
if (Configuration::get('PS_ORDER_PROCESS_TYPE') == 1)
|
||||
{
|
||||
$groups = (Validate::isLoadedObject($this->context->customer)) ? $this->context->customer->getGroups() : array(1);
|
||||
if ($this->context->cart->id_address_delivery)
|
||||
$deliveryAddress = new Address($this->context->cart->id_address_delivery);
|
||||
$id_country = (isset($deliveryAddress) && $deliveryAddress->id) ? $deliveryAddress->id_country : Configuration::get('PS_COUNTRY_DEFAULT');
|
||||
$result = array('carriers' => Carrier::getCarriersForOrder(Country::getIdZone($id_country), $groups));
|
||||
$result['carriers'] = Carrier::getCarriersForOrder(Country::getIdZone($id_country), $groups);
|
||||
$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);
|
||||
|
||||
@@ -46,11 +46,11 @@ class ParentOrderControllerCore extends FrontController
|
||||
public function init()
|
||||
{
|
||||
parent::init();
|
||||
|
||||
|
||||
/* Disable some cache related bugs on the cart/order */
|
||||
header('Cache-Control: no-cache, must-revalidate');
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
|
||||
|
||||
$this->nbProducts = $this->context->cart->nbProducts();
|
||||
|
||||
global $isVirtualCart;
|
||||
@@ -131,7 +131,7 @@ class ParentOrderControllerCore extends FrontController
|
||||
public function setMedia()
|
||||
{
|
||||
parent::setMedia();
|
||||
|
||||
|
||||
// Adding CSS style sheet
|
||||
$this->addCSS(_THEME_CSS_DIR_.'addresses.css');
|
||||
// Adding JS files
|
||||
@@ -462,27 +462,10 @@ class ParentOrderControllerCore extends FrontController
|
||||
*/
|
||||
protected function _setDefaultCarrierSelection($carriers)
|
||||
{
|
||||
if (count($carriers))
|
||||
{
|
||||
$defaultCarrierIsPresent = false;
|
||||
if ((int)self::$cart->id_carrier != 0)
|
||||
foreach ($carriers as $carrier)
|
||||
if ($carrier['id_carrier'] == (int)self::$cart->id_carrier)
|
||||
$defaultCarrierIsPresent = true;
|
||||
if (!$defaultCarrierIsPresent)
|
||||
foreach ($carriers as $carrier)
|
||||
if ($carrier['id_carrier'] == (int)Configuration::get('PS_CARRIER_DEFAULT'))
|
||||
{
|
||||
$defaultCarrierIsPresent = true;
|
||||
self::$cart->id_carrier = (int)$carrier['id_carrier'];
|
||||
}
|
||||
if (!$defaultCarrierIsPresent)
|
||||
self::$cart->id_carrier = (int)$carriers[0]['id_carrier'];
|
||||
}
|
||||
else
|
||||
self::$cart->id_carrier = 0;
|
||||
if (self::$cart->update())
|
||||
return self::$cart->id_carrier;
|
||||
$this->cart->id_carrier = Carrier::getDefaultCarrierSelection($carriers, (int)$this->cart->id_carrier);
|
||||
|
||||
if ($this->cart->update())
|
||||
return $this->cart->id_carrier;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user