Merge branch 'ticket-14805-creditexpiration'
This commit is contained in:
commit
f0772aa345
@ -40,5 +40,6 @@ $_LANGMAIL['Message from \').$customer->lastname.\' '] = 'Mensaje de \').$custom
|
||||
$_LANGMAIL[' $subject'] = '$subject';
|
||||
$_LANGMAIL['A friend sent you a link to\').\' '] = 'Un amigo le envio un enlace a\').\'';
|
||||
$_LANGMAIL['New voucher after refund'] = 'Nuevo código de reducción tras su devolución';
|
||||
$_LANGMAIL['Your loyalty credits'] = 'Mi crédito de fidelidad';
|
||||
|
||||
?>
|
43
mails/es/loyalty_discount_reminder.html
Normal file
43
mails/es/loyalty_discount_reminder.html
Normal file
@ -0,0 +1,43 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<title>Mensaje de {shop_name}</title>
|
||||
</head>
|
||||
<body>
|
||||
<table style="font-family: tahoma,arial,sans-serif; font-size: 12px; color: #000000; width: 550px;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td align="left"><a title="{shop_name}" href="{shop_url}"><img style="border: none;" src="{shop_logo}" alt="{shop_name}" /></a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">Buenos días <strong>{firstname} {lastname}</strong>,</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">
|
||||
Te informamos de que tienes disponible en tu cuenta el crédito de fidelidad generado por tu pedido {commandenum}
|
||||
<br />Este crédito expira dentro de 1 mes. Conéctate a nuestra web https://www.bebeboutik.es y benefíciate de descuentos de hasta el -70%!
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">Cordialmente,<br /> Servicio al cliente</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="font-size: 12px; border-top: 1px solid #cccccc; padding-top: 5px;" align="center">{shop_name} - <a style="color: #e26ea2;" href="{shop_url}">{shop_url}</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
8
mails/es/loyalty_discount_reminder.txt
Normal file
8
mails/es/loyalty_discount_reminder.txt
Normal file
@ -0,0 +1,8 @@
|
||||
Buenos días {firstname} {lastname},
|
||||
|
||||
Te informamos de que tienes disponible en tu cuenta el crédito de fidelidad generado por tu pedido {commandenum}.
|
||||
Este crédito expira dentro de 1 mes.
|
||||
|
||||
Conéctate a nuestra web https://www.bebeboutik.es y benefíciate de descuentos de hasta el -70%!
|
||||
|
||||
El equipo Bébé Boutik
|
@ -1,4 +1,4 @@
|
||||
Bonjour {firstname} {lastname},
|
||||
Buenos días {firstname} {lastname},
|
||||
|
||||
Acabamos de proceder a reembolsarte tu pedido. Para realizar el pago utilizaste un código de descuento.
|
||||
Te informamos de que dispones de un nuevo código para que puedas utilizarlo en tu próximo pedido : {voucher_num}.
|
||||
|
@ -36,5 +36,6 @@ $_LANGMAIL['Congratulations!'] = 'Bravo !';
|
||||
$_LANGMAIL['Referral Program'] = 'Programme de parrainage';
|
||||
$_LANGMAIL['A friend sent you a link to'] = 'Un ami vous a envoyé un lien vers';
|
||||
$_LANGMAIL['New voucher after refund'] = 'Nouveau bon de réduction après remboursement';
|
||||
$_LANGMAIL['Your loyalty credits'] = 'Vos crédits fidélités';
|
||||
|
||||
?>
|
||||
|
45
mails/fr/loyalty_discount_reminder.html
Normal file
45
mails/fr/loyalty_discount_reminder.html
Normal file
@ -0,0 +1,45 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<title>Message de {shop_name}</title>
|
||||
</head>
|
||||
<body>
|
||||
<table style="font-family: tahoma,arial,sans-serif; font-size: 12px; color: #000000; width: 550px;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td align="left"><a title="{shop_name}" href="{shop_url}"><img style="border: none;" src="{shop_logo}" alt="{shop_name}" /></a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">Bonjour <strong>{firstname} {lastname}</strong>,</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">
|
||||
Nous vous informons que vous avez dans votre compte un crédit de fidélité non utilisé suite à votre commande {commandenum}.
|
||||
Celui-ci expire dans 1 mois.
|
||||
|
||||
Venez nous rendre visite sur le site : https://wwww.bebeboutik.com et profiter de nos offres jusqu'à -70% !
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">L'équipe Bébé Boutik</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="font-size: 12px; border-top: 1px solid #cccccc; padding-top: 5px;" align="center">{shop_name} - <a style="color: #e26ea2;" href="{shop_url}">{shop_url}</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
8
mails/fr/loyalty_discount_reminder.txt
Normal file
8
mails/fr/loyalty_discount_reminder.txt
Normal file
@ -0,0 +1,8 @@
|
||||
Bonjour {firstname} {lastname},
|
||||
|
||||
Nous vous informons que vous avez dans votre compte un crédit de fidélité non utilisé suite à votre commande {commandenum}.
|
||||
Celui-ci expire dans 1 mois.
|
||||
|
||||
Venez nous rendre visite sur le site : https://wwww.bebeboutik.com et profiter de nos offres jusqu'à -70% !
|
||||
|
||||
L'équipe Bébé Boutik,
|
@ -1,4 +1,4 @@
|
||||
Bonjour {firstname} {lastname},
|
||||
Buenos días {firstname} {lastname},
|
||||
|
||||
Acabamos de proceder a reembolsarte tu pedido. Para realizar el pago utilizaste un código de descuento.
|
||||
Te informamos de que dispones de un nuevo código para que puedas utilizarlo en tu próximo pedido : {voucher_num}.
|
||||
|
36
modules/loyalty/bin/index.php
Normal file
36
modules/loyalty/bin/index.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 PrestaShop
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* This source file is subject to the Open Software License (OSL 3.0)
|
||||
* that is bundled with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://opensource.org/licenses/osl-3.0.php
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@prestashop.com so we can send you a copy immediately.
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||
* versions in the future. If you wish to customize PrestaShop for your
|
||||
* needs please refer to http://www.prestashop.com for more information.
|
||||
*
|
||||
* @author PrestaShop SA <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 7233 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
|
||||
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
header("Location: ../");
|
||||
exit;
|
111
modules/loyalty/bin/reminder.php
Normal file
111
modules/loyalty/bin/reminder.php
Normal file
@ -0,0 +1,111 @@
|
||||
<?php
|
||||
$_SERVER['HTTP_HOST'] = 'www.bebeboutik.com';
|
||||
$_SERVER['SERVER_NAME'] = 'www.bebeboutik.com';
|
||||
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
|
||||
$_SERVER['HTTP_PORT'] = 443;
|
||||
$_SERVER['HTTP_X_FORWARDED_PORT'] = 443;
|
||||
$_SERVER['SERVER_PORT'] = 443;
|
||||
|
||||
include __DIR__ . '/../../../config/settings.inc.php';
|
||||
include __DIR__ . '/../../../config/config.inc.php';
|
||||
|
||||
if(!Tools::isCli()){
|
||||
exit();
|
||||
}
|
||||
|
||||
$longopts = array(
|
||||
'verbose',
|
||||
'dry-run',
|
||||
'date:'
|
||||
);
|
||||
$shortopts = "";
|
||||
$options = getopt($shortopts, $longopts);
|
||||
|
||||
// Options
|
||||
$optVerbose = false;
|
||||
if (isset($options['verbose'])) {
|
||||
$optVerbose = true;
|
||||
}
|
||||
|
||||
$optTest = false;
|
||||
if (isset($options['dry-run'])) {
|
||||
$optTest = true;
|
||||
}
|
||||
|
||||
// Date
|
||||
$delay = new DateInterval('P1M');
|
||||
$dateSelect = new DateTime();
|
||||
if (isset($options['date'])) {
|
||||
$dateSelect->createFromFormat('Ymd', $options['date']);
|
||||
} else {
|
||||
$dateSelect->add($delay)->sub(new DateInterval('P1D'));
|
||||
}
|
||||
|
||||
// Start
|
||||
echo date('YmdHis')." - START ".$dateSelect->format('Y-m-d')." \n";
|
||||
|
||||
$dateSqlStart = $dateSelect->format('Y-m-d').' 00:00:00';
|
||||
$dateSqlEnd = $dateSelect->format('Y-m-d').' 23:59:59';
|
||||
$sql = "
|
||||
SELECT
|
||||
d.id_discount,
|
||||
d.id_customer,
|
||||
d.date_from,
|
||||
d.date_to,
|
||||
l.id_order
|
||||
FROM ps_discount d, ps_loyalty l
|
||||
WHERE d.active=1 AND d.id_discount=l.id_discount
|
||||
AND d.date_to > '".$dateSqlStart."' AND d.date_to < '".$dateSqlEnd."'";
|
||||
|
||||
if ($optVerbose) {
|
||||
echo date('YmdHis')." - START ".$dateSelect->format('Y-m-d')." \n";
|
||||
}
|
||||
|
||||
$result = Db::getInstance()->ExecuteS($sql);
|
||||
$nb = count($result);
|
||||
if ($optVerbose) { echo date('YmdHis')." - $nb mails to send \n"; }
|
||||
if ($nb > 0) {
|
||||
foreach($result as $l) {
|
||||
// Customer infos
|
||||
$customerModel = new Customer($l['id_customer']);
|
||||
|
||||
// Order infos
|
||||
$orderModel = new Order($l['id_order']);
|
||||
$id_lang = $orderModel->id_lang;
|
||||
|
||||
$templateVars = array(
|
||||
'{firstname}' => $customerModel->firstname,
|
||||
'{lastname}' => $customerModel->lastname,
|
||||
'{commandenum}' => $orderModel->id,
|
||||
);
|
||||
|
||||
echo date('YmdHis')." - Rappel credit pour le client ".$customerModel->email;
|
||||
|
||||
$to = $customerModel->email;
|
||||
// @todo : for test
|
||||
$to = 'ricois@antadis.com';
|
||||
|
||||
// Only Display values
|
||||
if ($optTest) {
|
||||
print_r($templateVars);
|
||||
echo "\n";
|
||||
}
|
||||
// Send mail
|
||||
else {
|
||||
|
||||
$isSent = Mail::Send($id_lang, 'loyalty_discount_reminder',
|
||||
Mail::l('Your loyalty credits', $id_lang), $templateVars, $to,
|
||||
$customerModel->firstname.' '.$customerModel->lastname);
|
||||
if ($isSent) {
|
||||
echo " - Envoyé";
|
||||
}
|
||||
else {
|
||||
echo " - ERROR";
|
||||
}
|
||||
|
||||
}
|
||||
echo "\n";
|
||||
}
|
||||
}
|
||||
|
||||
echo date('YmdHis')." - END\n";
|
@ -3,8 +3,8 @@ class Mail extends MailCore
|
||||
{
|
||||
public static function Send($id_lang, $template, $subject, $templateVars, $to, $toName = NULL, $from = NULL, $fromName = NULL, $fileAttachment = NULL, $modeSMTP = NULL, $templatePath = _PS_MAIL_DIR_, $die = false) {
|
||||
if(preg_match('/^contact\+(.*)@bebeboutik.com$/', $to)) {
|
||||
return TRUE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if(!isset($templateVars['product_list'])) {
|
||||
$templateVars['product_list'] = '';
|
||||
@ -152,9 +152,11 @@ class Mail extends MailCore
|
||||
/* Create mail and attach differents parts */
|
||||
$message = new Swift_Message('['.Configuration::get('PS_SHOP_NAME').'] '. $subject);
|
||||
|
||||
global $cookie;
|
||||
$id_lang = $cookie->id_lang;
|
||||
// surchage multilangue
|
||||
if ($id_lang === null) {
|
||||
global $cookie;
|
||||
$id_lang = $cookie->id_lang;
|
||||
}
|
||||
if ($id_lang) {
|
||||
$templateVars['{shop_logo}'] = (file_exists(_PS_IMG_DIR_.'logo_mail_'.(int) $id_lang.'.jpg')) ? $message->attach(new Swift_Message_Image(new Swift_File(_PS_IMG_DIR_.'logo_mail_'.(int) $id_lang.'.jpg'))) : ((file_exists(_PS_IMG_DIR_.'logo.jpg')) ? $message->attach(new Swift_Message_Image(new Swift_File(_PS_IMG_DIR_.'logo.jpg'))) : '');
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user