// Merge 1.4 => 1.5
This commit is contained in:
@@ -193,7 +193,8 @@ class MondialRelay extends Module
|
||||
!$this->registerHook('extraCarrier') ||
|
||||
!$this->registerHook('updateCarrier') ||
|
||||
!$this->registerHook('newOrder') ||
|
||||
!$this->registerHook('BackOfficeHeader')))
|
||||
!$this->registerHook('BackOfficeHeader') ||
|
||||
!$this->registerHook('paymentTop')))
|
||||
return false;
|
||||
|
||||
if (_PS_VERSION_ >= '1.4' &&
|
||||
@@ -626,17 +627,16 @@ class MondialRelay extends Module
|
||||
if ((Configuration::get('PS_SHIPPING_METHOD') AND (!Carrier::checkDeliveryPriceByWeight($row['id_carrier'], $this->context->cart->getTotalWeight(), $id_zone))) OR
|
||||
(!Configuration::get('PS_SHIPPING_METHOD') AND (!Carrier::checkDeliveryPriceByPrice($row['id_carrier'], $this->context->cart->getOrderTotal(true, self::BOTH_WITHOUT_SHIPPING), $id_zone, $this->context->cart->id_currency))))
|
||||
unset($carriersList[$k]);
|
||||
}
|
||||
}
|
||||
|
||||
// $address_map = $address->address1.', '.$address->postcode.', '.
|
||||
// MRTools::replaceAccentedCharacters($address->city).', '.$country->iso_code;
|
||||
|
||||
$this->context->smarty->assign( array(
|
||||
'one_page_checkout' => (Configuration::get('PS_ORDER_PROCESS_TYPE') ? Configuration::get('PS_ORDER_PROCESS_TYPE') : 0),
|
||||
'new_base_dir' => self::$moduleURL,
|
||||
}
|
||||
|
||||
$preSelectedRelay = $this->getRelayPointSelected($params['cart']->id);
|
||||
$this->context->smarty->assign( array(
|
||||
'one_page_checkout' => (Configuration::get('PS_ORDER_PROCESS_TYPE') ? Configuration::get('PS_ORDER_PROCESS_TYPE') : 0),
|
||||
'new_base_dir' => self::$moduleURL,
|
||||
'MRToken' => self::$MRFrontToken,
|
||||
'carriersextra' => $carriersList,
|
||||
'preSelectedRelay' => isset($preSelectedRelay['MR_selected_num']) ? $preSelectedRelay['MR_selected_num'] : '',
|
||||
'jQueryOverload' => self::getJqueryCompatibility()));
|
||||
|
||||
return $this->display(__FILE__, 'mondialrelay.tpl');
|
||||
@@ -1247,4 +1247,27 @@ class MondialRelay extends Module
|
||||
return $statCode[$code];
|
||||
return $this->l('This error isn\'t referred : ') . $code;
|
||||
}
|
||||
|
||||
public function getRelayPointSelected($id_cart)
|
||||
{
|
||||
return Db::getInstance()->getRow('
|
||||
SELECT s.`MR_selected_num`
|
||||
FROM `'._DB_PREFIX_.'mr_selected` s
|
||||
WHERE s.`id_cart` = '.(int)$id_cart);
|
||||
}
|
||||
|
||||
public function isMondialRelayCarrier($id_carrier)
|
||||
{
|
||||
return Db::getInstance()->getRow('
|
||||
SELECT `id_carrier`
|
||||
FROM `'._DB_PREFIX_.'mr_method`
|
||||
WHERE `id_carrier` = '.(int)$id_carrier);
|
||||
}
|
||||
|
||||
public function hookpaymentTop($params)
|
||||
{
|
||||
if ($this->isMondialRelayCarrier($params['cart']->id_carrier) &&
|
||||
!$this->getRelayPointSelected($params['cart']->id))
|
||||
$params['cart']->id_carrier = 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user