Merge branch 'ticket-ChangeDeliveryAddress' into develop

This commit is contained in:
Marion Muszynski 2016-10-19 18:31:35 +02:00
commit 22663f53b5

View File

@ -31,27 +31,6 @@ if ($cookie->isLogged()) {
if (empty($mode)) {
$mode = "DOM";
}
Db::getInstance()->Execute('UPDATE ps_socolissimo_delivery_info SET
delivery_mode = "'.pSQL($mode).'",
prname = "'.pSQL(Tools::getValue('prname', '')).'",
prfirstname = "'.pSQL(Tools::getValue('prfirstname', '')).'",
cecompanyname = "'.pSQL(Tools::getValue('cecompanyname', '')).'",
cename = "'.pSQL(Tools::getValue('cename', '')).'",
cefirstname = "'.pSQL(Tools::getValue('cefirstname', '')).'",
prcompladress = "'.pSQL(Tools::getValue('prcompladress', '')).'",
pradress1 = "'.pSQL(Tools::getValue('pradress1', '')).'",
pradress2 = "'.pSQL(Tools::getValue('pradress2', '')).'",
pradress3 = "'.pSQL(Tools::getValue('pradress3', '')).'",
pradress4 = "'.pSQL(Tools::getValue('pradress4', '')).'",
przipcode = "'.pSQL(Tools::getValue('przipcode', '')).'",
prtown = "'.pSQL(Tools::getValue('prtown', '')).'",
cephonenumber = "'.pSQL(Tools::getValue('cephonenumber', '')).'",
ceemail = "'.pSQL(Tools::getValue('ceemail', '')).'",
cedeliveryinformation = "'.pSQL(Tools::getValue('cedeliveryinformation', '')).'",
cedoorcode1 = "'.pSQL(Tools::getValue('cedoorcode1', '')).'",
cedoorcode2 = "'.pSQL(Tools::getValue('cedoorcode2', '')).'",
prid = "'.pSQL(Tools::getValue('prid', '')).'"
WHERE id_cart = '.pSQL(intval(Tools::getValue('id_cart'))));
if ($mode == "DOM" && Tools::getValue('id_address_delivery')) {
$newAddressId = Tools::getValue('id_address_delivery');
@ -69,6 +48,7 @@ if ($cookie->isLogged()) {
pSQL(Tools::getValue('cefirstname', ''))
);
}
if($newAddressId) {
$errors = array();
$delivery = new Address((int)$newAddressId);
@ -103,6 +83,34 @@ if ($cookie->isLogged()) {
if (empty($errors)) {
$order->id_address_delivery = (int)$newAddressId;
$order->update();
if(Db::getInstance()->getRow('
SELECT *
FROM `'._DB_PREFIX_.'socolissimo_delivery_info`
WHERE id_cart = '.pSQL(intval(Tools::getValue('id_cart'))).'')
) {
Db::getInstance()->Execute('UPDATE ps_socolissimo_delivery_info SET
delivery_mode = "'.pSQL($mode).'",
prname = "'.pSQL(Tools::getValue('prname', $delivery->lastname)).'",
prfirstname = "'.pSQL(Tools::getValue('prfirstname', $delivery->firstname)).'",
cecompanyname = "'.pSQL(Tools::getValue('cecompanyname', (!empty($delivery->company)?$delivery->company:''))).'",
cename = "'.pSQL(Tools::getValue('cename', '')).'",
cefirstname = "'.pSQL(Tools::getValue('cefirstname', '')).'",
prcompladress = "'.pSQL(Tools::getValue('prcompladress', '')).'",
pradress1 = "'.pSQL(Tools::getValue('pradress1', (!empty($delivery->address1)?$delivery->address1:''))).'",
pradress2 = "'.pSQL(Tools::getValue('pradress2', (!empty($delivery->address2)?$delivery->address2:''))).'",
pradress3 = "'.pSQL(Tools::getValue('pradress3', '')).'",
pradress4 = "'.pSQL(Tools::getValue('pradress4', '')).'",
przipcode = "'.pSQL(Tools::getValue('przipcode', (!empty($delivery->postcode)?$delivery->postcode:''))).'",
prtown = "'.pSQL(Tools::getValue('prtown', (!empty($delivery->city)?$delivery->city:''))).'",
cephonenumber = "'.pSQL(Tools::getValue('cephonenumber', ($delivery->phone_mobile ? $delivery->phone_mobile : ($delivery->phone ? $delivery->phone : '')) )).'",
ceemail = "'.pSQL(Tools::getValue('ceemail', (!empty($customer->email)?$customer->email:''))).'",
cedeliveryinformation = "'.pSQL(Tools::getValue('cedeliveryinformation', '')).'",
cedoorcode1 = "'.pSQL(Tools::getValue('cedoorcode1', '')).'",
cedoorcode2 = "'.pSQL(Tools::getValue('cedoorcode2', '')).'",
prid = "'.pSQL(Tools::getValue('prid', '')).'"
WHERE id_cart = '.pSQL(intval(Tools::getValue('id_cart'))));
}
}
}
} else {