isLoggedBack() && $cart = Tools::getValue('id_cart')) { $address = Db::getInstance()->getRow(' SELECT s.*, m.*, r.`narel` FROM `'._DB_PREFIX_.'mr_selected` s INNER JOIN `'._DB_PREFIX_.'mr_method` m ON m.`id_mr_method` = s.`id_method` LEFT JOIN `'._DB_PREFIX_.'mondialrelay_relais` r ON SUBSTRING(s.`MR_Selected_Num`, 2) = r.`direction` AND s.`MR_Selected_Pays` = r.`prpay` WHERE `id_cart` = '.pSQL(intval(Tools::getValue('id_cart'))).' '); if($address['MR_Selected_Pays'] == 'F' || $address['MR_Selected_Pays'] == '') { $address['MR_Selected_Pays'] = 'FR'; } $deliv_address = Db::getInstance()->getRow(' SELECT * FROM `'._DB_PREFIX_.'address` a LEFT JOIN `'._DB_PREFIX_.'orders` o ON a.`id_address` = o.`id_address_delivery` WHERE o.`id_cart` = '.(int) Tools::getValue('id_cart').' '); if($address) { if(isset($_POST['submitMR'])) { $num = Tools::getValue('MR_Selected_Num', ''); if($num != '') { $rel = Db::getInstance()->getRow(' SELECT * FROM `'._DB_PREFIX_.'mondialrelay_relais` WHERE `direction` = "'.pSQL(sprintf('%05d', (int) ((string) substr($num, -5)))).'" AND `prpay` = "'.pSQL($address['MR_Selected_Pays']).'" '); if($rel) { Db::getInstance()->Execute(' UPDATE `'._DB_PREFIX_.'mr_selected` SET `MR_Selected_Num` = "'.pSQL($num).'", `MR_Selected_LgAdr1` = "'.pSQL(trim($rel['colnom'])).'", `MR_Selected_LgAdr2` = "'.pSQL(trim($rel['colbat'])).'", `MR_Selected_LgAdr3` = "'.pSQL(trim($rel['colrue'])).'", `MR_Selected_LgAdr4` = "'.pSQL(trim($rel['coldit'])).'", `MR_Selected_CP` = "'.pSQL(trim($rel['codpos'])).'", `MR_Selected_Ville` = "'.pSQL(trim($rel['libbp'])).'", `MR_Selected_Pays` = "'.pSQL(trim($rel['prpay'])).'" WHERE `id_cart` = '.(int) Tools::getValue('id_cart').' '); } } } $order = Db::getInstance()->getRow(' SELECT `id_carrier`, `id_order`, `id_address_delivery` FROM `'._DB_PREFIX_.'orders` WHERE `id_cart` = '.(int) Tools::getValue('id_cart').' '); $weight = (float) Db::getInstance()->getValue(' SELECT SUM(`product_weight` * `product_quantity`) FROM `'._DB_PREFIX_.'order_detail` WHERE `id_order` = '.(int) $order['id_order'].' '); ?>