change message in mail order_conf

This commit is contained in:
Marion Muszynski 2017-01-11 18:02:31 +01:00
parent 80e0bffe4f
commit 262cac694a
2 changed files with 62 additions and 12 deletions

View File

@ -99,8 +99,8 @@
<td align="left"> <td align="left">
{delivery_date} {delivery_date}
<br /> <br />
Vous recevrez un email contenant le num&eacute;ro de suivi du colis 48h avant. {delivery_desc}
</td> </td>
</tr> </tr>
<tr><td>&nbsp;</td></tr> <tr><td>&nbsp;</td></tr>
<tr> <tr>

View File

@ -3,7 +3,7 @@
public function validateOrder($id_cart, $id_order_state, $amountPaid, $paymentMethod = 'Unknown', $message = NULL, $extraVars = array(), $currency_special = NULL, $dont_touch_amount = false, $secure_key = false) public function validateOrder($id_cart, $id_order_state, $amountPaid, $paymentMethod = 'Unknown', $message = NULL, $extraVars = array(), $currency_special = NULL, $dont_touch_amount = false, $secure_key = false)
{ {
global $cart; global $cart;
$cart = new Cart((int)($id_cart)); $cart = new Cart((int)($id_cart));
// Does order already exists ? // Does order already exists ?
if (Validate::isLoadedObject($cart) AND $cart->OrderExists() == false) if (Validate::isLoadedObject($cart) AND $cart->OrderExists() == false)
@ -361,13 +361,37 @@
$invoice = new Address((int)($order->id_address_invoice)); $invoice = new Address((int)($order->id_address_invoice));
$delivery = new Address((int)($order->id_address_delivery)); $delivery = new Address((int)($order->id_address_delivery));
$carrier = new Carrier((int)($order->id_carrier), $order->id_lang); $carrier = new Carrier((int)($order->id_carrier), $order->id_lang);
/**
* #Override Antadis - Mondiale relay - Socol
*/
$_tr_delivery_desc = array(
2 => array(
'MR' => '<p>Votre colis sera livré <strong>chez un commerçant</strong> du réseau Mondial Relay. Vous serez prévenu de la mise à disposition de votre colis par e-mail. Vous disposez alors de 10 jours ouvrables pour le récupérer. Passé ce délai, il nous sera automatiquement retourné.</p>',
'SOCOL_OOH' => '<p>Vous serez prévenu de la mise à disposition de votre colis par e-mail. Vous disposez alors de 10 jours ouvrables pour le récupérer. Passé ce délai, il nous sera automatiquement retourné.<p>',
'DOM' => '<p>Vos produits vous seront remis en main propre <strong>à ladresse de votre commande</strong>. Vous recevrez un email contenant le numéro de suivi du colis 48h avant. En cas dabsence, votre colis sera déposé dans votre boîte aux lettres si son volume le permet.<br/>Dans le cas contraire, un avis de passage vous sera remis. Vous disposez alors de 10 jours ouvrables pour retirer votre colis dans votre bureau de poste. Passé ce délai, celui-ci nous sera automatiquement renvoyé. Et nous vous contacterons.</p>',
),
3 => array(
'DOM' => '<p>Recibirás un email con el número de seguimiento de tu pedido 48h antes.</p>',
)
);
if ($carrier->id == (int)Configuration::get('ANT_CARRIER_DOM') || $carrier->id == (int)Configuration::get('ANT_CARRIER_DROP')) {
$delivery_carrier = 'DOM';
} elseif (in_array($carrier->id, array_map('intval',explode(',', Configuration::get('ANT_CARRIERS_SOCOL'))))) {
$delivery_carrier = 'SOCOL_OOH';
} elseif (in_array($carrier->id, array_map('intval',explode(',', Configuration::get('ANT_CARRIERS_MR'))))) {
$delivery_carrier = 'MR';
} else {
$delivery_carrier = 'DOM'
}
$delivery_state = $delivery->id_state ? new State((int)($delivery->id_state)) : false; $delivery_state = $delivery->id_state ? new State((int)($delivery->id_state)) : false;
$invoice_state = $invoice->id_state ? new State((int)($invoice->id_state)) : false; $invoice_state = $invoice->id_state ? new State((int)($invoice->id_state)) : false;
// $date = new DateTime(); // $date = new DateTime();
// $date->add(new DateInterval('P21D')); // $date->add(new DateInterval('P21D'));
// $date = $date->format('d/m/Y'); // $date = $date->format('d/m/Y');
$date_order = new DateTime(); $date_order = new DateTime();
$date_order = $date_order->format('d/m/Y'); $date_order = $date_order->format('d/m/Y');
$date = new DateTime(); $date = new DateTime();
@ -382,16 +406,41 @@
$params = array('id_order' => $order->id, 'id_lang' => $cookie->id_lang); $params = array('id_order' => $order->id, 'id_lang' => $cookie->id_lang);
$delivery_date = Module::hookExec('deliveryDelay', $params); $delivery_date = Module::hookExec('deliveryDelay', $params);
// @Override Mondial relay delivery
if ($mr = Db::getInstance()->getRow('
SELECT s.*, c.`id_country`
FROM `' . _DB_PREFIX_ . 'mr_selected` s
LEFT JOIN `' . _DB_PREFIX_ . 'mr_method` m
ON m.`id_mr_method` = s.`id_method`
LEFT JOIN `' . _DB_PREFIX_ . 'country` c
ON c.`iso_code` = s.`MR_Selected_Pays`
WHERE m.`id_carrier` = ' . (int) $carrier->id . '
AND s.`id_cart` = ' . (int) $order->id_cart . '
AND m.`id_mr_method` IS NOT NULL
')) {
$delivery->firstname = $mr['MR_Selected_LgAdr1'];
$delivery->lastname = $mr['MR_Selected_LgAdr2'];
$delivery->address1 = $mr['MR_Selected_LgAdr3'];
$delivery->address2 = $mr['MR_Selected_LgAdr4'];
$delivery->postcode = $mr['MR_Selected_CP'];
$delivery->city = $mr['MR_Selected_Ville'];
$delivery->id_country = isset($mr['id_country']) && $mr['id_country'] ? (int) $mr['id_country'] : 8;
}
$delivery_block_html = $this->_getFormatedAddress(
$delivery,
"<br />",
array(
'firstname' => '<span style="color:#DB3484; font-weight:bold;">%s</span>',
'lastname' => '<span style="color:#DB3484; font-weight:bold;">%s</span>')
);
$data = array( $data = array(
'{firstname}' => $customer->firstname, '{firstname}' => $customer->firstname,
'{lastname}' => $customer->lastname, '{lastname}' => $customer->lastname,
'{email}' => $customer->email, '{email}' => $customer->email,
'{delivery_block_txt}' => $this->_getFormatedAddress($delivery, "\n"), '{delivery_block_txt}' => $this->_getFormatedAddress($delivery, "\n"),
'{invoice_block_txt}' => $this->_getFormatedAddress($invoice, "\n"), '{invoice_block_txt}' => $this->_getFormatedAddress($invoice, "\n"),
'{delivery_block_html}' => $this->_getFormatedAddress($delivery, "<br />", '{delivery_block_html}' => $delivery_block_html,
array(
'firstname' => '<span style="color:#DB3484; font-weight:bold;">%s</span>',
'lastname' => '<span style="color:#DB3484; font-weight:bold;">%s</span>')),
'{invoice_block_html}' => $this->_getFormatedAddress($invoice, "<br />", '{invoice_block_html}' => $this->_getFormatedAddress($invoice, "<br />",
array( array(
'firstname' => '<span style="color:#DB3484; font-weight:bold;">%s</span>', 'firstname' => '<span style="color:#DB3484; font-weight:bold;">%s</span>',
@ -430,7 +479,8 @@
'{total_products}' => Tools::displayPrice($order->total_paid - $order->total_shipping - $order->total_wrapping + $order->total_discounts, $currency, false), '{total_products}' => Tools::displayPrice($order->total_paid - $order->total_shipping - $order->total_wrapping + $order->total_discounts, $currency, false),
'{total_discounts}' => Tools::displayPrice($order->total_discounts, $currency, false), '{total_discounts}' => Tools::displayPrice($order->total_discounts, $currency, false),
'{total_shipping}' => Tools::displayPrice($order->total_shipping, $currency, false), '{total_shipping}' => Tools::displayPrice($order->total_shipping, $currency, false),
'{total_wrapping}' => Tools::displayPrice($order->total_wrapping, $currency, false) '{total_wrapping}' => Tools::displayPrice($order->total_wrapping, $currency, false),
'{delivery_desc}' => $_tr_delivery_desc[(int) $cart->id_lang][$delivery_carrier]
); );
if (is_array($extraVars)) if (is_array($extraVars))
@ -447,10 +497,10 @@
else else
$fileAttachment = NULL; $fileAttachment = NULL;
if (Validate::isEmail($customer->email)){ if (Validate::isEmail($customer->email)){
Mail::Send((int)$order->id_lang, 'order_conf', Mail::l('Order confirmation', (int)$order->id_lang), $data, $customer->email, $customer->firstname.' '.$customer->lastname, NULL, NULL, $fileAttachment); Mail::Send((int)$order->id_lang, 'order_conf', Mail::l('Order confirmation', (int)$order->id_lang), $data, $customer->email, $customer->firstname.' '.$customer->lastname, NULL, NULL, $fileAttachment);
} }
} }
$this->currentOrder = (int)$order->id; $this->currentOrder = (int)$order->id;