Modification et affichage adresse socolissimo lorsque livraison domicile
This commit is contained in:
parent
5eb320c4de
commit
5e3c35b95b
@ -152,10 +152,44 @@ class AdminAddresses extends AdminTab
|
||||
$address_type = ((int)(Tools::getValue('address_type')) == 2 ? 'invoice' : ((int)(Tools::getValue('address_type')) == 1 ? 'delivery' : ''));
|
||||
if (isset($_POST['submitAdd'.$this->table]) AND ($id_order = (int)(Tools::getValue('id_order'))) AND !sizeof($this->_errors) AND !empty($address_type))
|
||||
{
|
||||
if (!Db::getInstance()->Execute('UPDATE '._DB_PREFIX_.'orders SET `id_address_'.$address_type.'` = '.Db::getInstance()->Insert_ID().' WHERE `id_order` = '.$id_order))
|
||||
if (!Db::getInstance()->Execute('UPDATE '._DB_PREFIX_.'orders SET `id_address_'.$address_type.'` = '.Db::getInstance()->Insert_ID().' WHERE `id_order` = '.$id_order)) {
|
||||
$this->_errors[] = Tools::displayError('An error occurred while linking this address to its order.');
|
||||
else
|
||||
Tools::redirectAdmin(Tools::getValue('back').'&conf=4');
|
||||
}
|
||||
else {
|
||||
// If socol AND delivery to DOM AND address change, update ps_socolissimo_delivery_info
|
||||
$cart = Cart::getCartByOrderId($id_order);
|
||||
if ((int)$cart->id_carrier == (int)Configuration::get('ANT_CARRIER_DOM')) {
|
||||
$socol = Db::getInstance()->getRow('
|
||||
SELECT * FROM `'._DB_PREFIX_.'socolissimo_delivery_info`
|
||||
WHERE `id_cart` = '.(int)$cart->id.'
|
||||
AND `cecountry` IN ("FR","BE","ES") AND `delivery_mode`="DOM"
|
||||
AND (`pradress1`!="" OR `pradress2`!="" OR `pradress3`!="" OR `pradress4`!="")
|
||||
');
|
||||
if ($socol) {
|
||||
// Get address
|
||||
$delivery = new Address($_POST['id_address']);
|
||||
// Update So Colissimo Address - for printing label
|
||||
Db::getInstance()->Execute('UPDATE `'._DB_PREFIX_.'socolissimo_delivery_info` SET
|
||||
prname = "'.$delivery->lastname.'",
|
||||
prfirstname = "'.$delivery->firstname.'",
|
||||
cecompanyname = "'.$delivery->company.'",
|
||||
cename = "'.$delivery->lastname.'",
|
||||
cefirstname = "'.$delivery->firstname.'",
|
||||
prcompladress = "",
|
||||
pradress1 = "",
|
||||
pradress2 = "",
|
||||
pradress3 = "'.$delivery->address1.'",
|
||||
pradress4 = "'.$delivery->address2.'",
|
||||
przipcode = "'.$delivery->postcode.'",
|
||||
prtown = "'.$delivery->city.'",
|
||||
cephonenumber = "'.($delivery->phone_mobile ? $delivery->phone_mobile : ($delivery->phone ? $delivery->phone : '')).'"
|
||||
WHERE id_cart = '.(int)$cart->id
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Tools::redirectAdmin(Tools::getValue('back').'&conf=4');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2952,7 +2952,8 @@ class AdminOrders extends AdminTab
|
||||
AND `cecountry` IN ("FR","BE","ES")
|
||||
AND (`pradress1`!= "" OR `pradress2`!= "" OR `pradress3`!= "" OR `pradress4`!= "")
|
||||
');
|
||||
if($socol && (int)$cart->id_carrier != (int)Configuration::get('ANT_CARRIER_DOM')) {
|
||||
// If socol AND id_carrier is DOM
|
||||
if($socol && (int)$cart->id_carrier == (int)Configuration::get('ANT_CARRIER_DOM')) {
|
||||
$order_address = nl2br(preg_replace("/(\r\n){2,}/", "\r\n", implode("\r\n", array(
|
||||
$socol['cefirstname'].' '.$socol['cename'],
|
||||
$socol['cecompanyname'],
|
||||
|
Loading…
Reference in New Issue
Block a user