Merge branch 'bootstrap' of https://github.com/PrestaShop/PrestaShop into bootstrap
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
<module>
|
||||
<name>mailalerts</name>
|
||||
<displayName><![CDATA[Mail alerts]]></displayName>
|
||||
<version><![CDATA[2.5]]></version>
|
||||
<version><![CDATA[2.7]]></version>
|
||||
<description><![CDATA[Sends e-mail notifications to customers and merchants.]]></description>
|
||||
<author><![CDATA[PrestaShop]]></author>
|
||||
<tab><![CDATA[administration]]></tab>
|
||||
|
||||
@@ -46,7 +46,7 @@ class MailAlerts extends Module
|
||||
{
|
||||
$this->name = 'mailalerts';
|
||||
$this->tab = 'administration';
|
||||
$this->version = '2.5';
|
||||
$this->version = '2.7';
|
||||
$this->author = 'PrestaShop';
|
||||
$this->need_instance = 0;
|
||||
|
||||
@@ -194,6 +194,21 @@ class MailAlerts extends Module
|
||||
$this->init();
|
||||
}
|
||||
|
||||
public function getAllMessages($id)
|
||||
{
|
||||
$messages = Db::getInstance()->executeS('
|
||||
SELECT `message`
|
||||
FROM `'._DB_PREFIX_.'message`
|
||||
WHERE `id_order` = '.(int)$id.'
|
||||
ORDER BY `id_message` ASC
|
||||
');
|
||||
$result = array();
|
||||
foreach ($messages as $message) {
|
||||
$result[] = $message['message'];
|
||||
}
|
||||
return implode('<br/>', $result);
|
||||
}
|
||||
|
||||
public function hookActionValidateOrder($params)
|
||||
{
|
||||
if (!$this->_merchant_order || empty($this->_merchant_mails))
|
||||
@@ -209,9 +224,9 @@ class MailAlerts extends Module
|
||||
$configuration = Configuration::getMultiple(array('PS_SHOP_EMAIL', 'PS_MAIL_METHOD', 'PS_MAIL_SERVER', 'PS_MAIL_USER', 'PS_MAIL_PASSWD', 'PS_SHOP_NAME', 'PS_MAIL_COLOR'), $id_lang, null, $id_shop);
|
||||
$delivery = new Address((int)$order->id_address_delivery);
|
||||
$invoice = new Address((int)$order->id_address_invoice);
|
||||
$order_date_text = Tools::displayDate($order->date_add, (int)$id_lang);
|
||||
$order_date_text = Tools::displayDate($order->date_add);
|
||||
$carrier = new Carrier((int)$order->id_carrier);
|
||||
$message = $order->getFirstMessage();
|
||||
$message = $this->getAllMessages($order->id);
|
||||
|
||||
if (!$message || empty($message))
|
||||
$message = $this->l('No message');
|
||||
@@ -315,6 +330,7 @@ class MailAlerts extends Module
|
||||
'{total_products}' => Tools::displayPrice($order->getTotalProductsWithTaxes(), $currency),
|
||||
'{total_discounts}' => Tools::displayPrice($order->total_discounts, $currency),
|
||||
'{total_shipping}' => Tools::displayPrice($order->total_shipping, $currency),
|
||||
'{total_tax_paid}' => Tools::displayPrice(($order->total_products_wt - $order->total_products) + ($order->total_shipping_tax_incl - $order->total_shipping_tax_excl), $currency, false),
|
||||
'{total_wrapping}' => Tools::displayPrice($order->total_wrapping, $currency),
|
||||
'{currency}' => $currency->sign,
|
||||
'{message}' => $message
|
||||
@@ -374,16 +390,20 @@ class MailAlerts extends Module
|
||||
public function hookActionUpdateQuantity($params)
|
||||
{
|
||||
$id_product = (int)$params['id_product'];
|
||||
$product = new Product($id_product);
|
||||
$product_has_attributes = $product->hasAttributes();
|
||||
$id_product_attribute = (int)$params['id_product_attribute'];
|
||||
$quantity = (int)$params['quantity'];
|
||||
$context = Context::getContext();
|
||||
$id_shop = (int)$context->shop->id;
|
||||
$id_lang = (int)$context->language->id;
|
||||
$product = new Product($id_product, true, $id_lang, $id_shop, $context);
|
||||
$configuration = Configuration::getMultiple(array('MA_LAST_QTIES', 'PS_STOCK_MANAGEMENT', 'PS_SHOP_EMAIL', 'PS_SHOP_NAME'), $id_lang, null, $id_shop);
|
||||
$configuration = Configuration::getMultiple(array('MA_LAST_QTIES', 'PS_STOCK_MANAGEMENT', 'PS_SHOP_EMAIL', 'PS_SHOP_NAME'), null, null, $id_shop);
|
||||
$ma_last_qties = (int)$configuration['MA_LAST_QTIES'];
|
||||
|
||||
if ($product->active == 1 && (int)$quantity <= $ma_last_qties && !(!$this->_merchant_oos || empty($this->_merchant_mails)) && $configuration['PS_STOCK_MANAGEMENT'])
|
||||
|
||||
$check_oos = ($product_has_attributes && $id_product_attribute) || (!$product_has_attributes && !$id_product_attribute);
|
||||
|
||||
if ($check_oos && $product->active == 1 && (int)$quantity <= $ma_last_qties && !(!$this->_merchant_oos || empty($this->_merchant_mails)) && $configuration['PS_STOCK_MANAGEMENT'])
|
||||
{
|
||||
$iso = Language::getIsoById($id_lang);
|
||||
$product_name = Product::getProductName($id_product, $id_product_attribute, $id_lang);
|
||||
@@ -662,8 +682,7 @@ class MailAlerts extends Module
|
||||
'type' => 'textarea',
|
||||
'label' => $this->l('E-mail addresses:'),
|
||||
'name' => 'MA_MERCHANT_MAILS',
|
||||
'desc' => $this->l('One e-mail address per line (e.g. bob@example.com)
|
||||
'),
|
||||
'desc' => $this->l('One e-mail address per line (e.g. bob@example.com)'),
|
||||
),
|
||||
),
|
||||
'submit' => array(
|
||||
@@ -707,4 +726,4 @@ class MailAlerts extends Module
|
||||
'MA_MERCHANT_MAILS' => Tools::getValue('MA_MERCHANT_MAILS', Configuration::get('MA_MERCHANT_MAILS')),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
<?php include ('header.php'); ?>
|
||||
|
||||
<tr>
|
||||
<td align="center">
|
||||
<span class="title"><?php echo t('Hi,'); ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="box">
|
||||
<p>
|
||||
<?php echo t('{product} is now available.'); ?>
|
||||
</p>
|
||||
<span>
|
||||
<?php echo t('This item is once again in-stock.'); ?><br /><br />
|
||||
<?php echo t('You can access the product page by clicking on the link:'); ?> <span><strong><a href="{product_link}">{product}</a></strong></span><br />
|
||||
<?php echo t('You can order it right now from our online shop.'); ?>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php include ('footer.php'); ?>
|
||||
@@ -1,15 +0,0 @@
|
||||
<tr>
|
||||
<td class="space_footer"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="footer">
|
||||
<span><?php echo t('<a href="{shop_url}">{shop_name}</a> powered by <a href="http://www.prestashop.com/">PrestaShop™</a>'); ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<td class="space"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,54 +0,0 @@
|
||||
<?php
|
||||
if(!function_exists('t'))
|
||||
{
|
||||
function t($str)
|
||||
{
|
||||
return $str;
|
||||
}
|
||||
}
|
||||
|
||||
if(!function_exists('findRelativePathToAdminDir'))
|
||||
{
|
||||
function findRelativePathToAdminDir($maxDepth=6)
|
||||
{
|
||||
$path = '';
|
||||
for($i=0; $i<$maxDepth; $i++)
|
||||
{
|
||||
foreach(scandir(dirname(__FILE__).'/'.$path) as $dir)
|
||||
{
|
||||
$candidate = $path.$dir.'/';
|
||||
if(is_dir(dirname(__FILE__).'/'.$candidate.'tabs'))
|
||||
{
|
||||
return $candidate;
|
||||
}
|
||||
}
|
||||
$path .= '../';
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$admin = findRelativePathToAdminDir();
|
||||
?>
|
||||
|
||||
<!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><?php echo t('Message from {shop_name}'); ?></title>
|
||||
<link rel="stylesheet" type="text/css" href="<?php echo $admin ?>themes/default/css/admin-theme/email.css">
|
||||
</head>
|
||||
<body>
|
||||
<table class="table table-mail">
|
||||
<tr>
|
||||
<td class="space"> </td>
|
||||
<td align="center">
|
||||
<table class="table">
|
||||
<tr>
|
||||
<td align="center" class="logo">
|
||||
<a title="{shop_name}" href="{shop_url}">
|
||||
<img src="{shop_logo}" alt="{shop_name}" />
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -1,125 +0,0 @@
|
||||
<?php include ('header.php'); ?>
|
||||
|
||||
<tr>
|
||||
<td align="center">
|
||||
<span class="title"><?php echo t('Congratulations!'); ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<span><?php echo t('A new order was placed on {shop_name} from the following customer: {firstname} {lastname} ({email})'); ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="box" colspan="3">
|
||||
<p>
|
||||
<?php echo t('Order details'); ?>
|
||||
</p>
|
||||
<span>
|
||||
<span><strong><?php echo t('Order:'); ?></strong></span> {order_name} <?php echo t('Placed on'); ?> {date}<br /><br />
|
||||
<span><strong><?php echo t('Payment:'); ?></strong></span> {payment}
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<table class="table table-recap" bgcolor="#ffffff"><!-- Title -->
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?php echo t('Reference'); ?></th>
|
||||
<th width="30%"><?php echo t('Product'); ?></th>
|
||||
<th><?php echo t('Unit price'); ?></th>
|
||||
<th><?php echo t('Quantity'); ?></th>
|
||||
<th><?php echo t('Total price'); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colspan="5">
|
||||
{items}
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="conf_body">
|
||||
<td bgcolor="#fbfbfb" align="right" colspan="4"><strong><?php echo t('Products'); ?></strong></td>
|
||||
<td bgcolor="#fbfbfb" align="right">{total_products}</td>
|
||||
</tr>
|
||||
<tr class="conf_body">
|
||||
<td bgcolor="#fbfbfb" align="right" colspan="4"><strong><?php echo t('Discounts'); ?></strong></td>
|
||||
<td bgcolor="#fbfbfb" align="right">{total_discounts}</td>
|
||||
</tr>
|
||||
<tr class="conf_body">
|
||||
<td bgcolor="#fbfbfb" align="right" colspan="4"><strong><?php echo t('Gift-wrapping'); ?></strong></td>
|
||||
<td bgcolor="#fbfbfb" align="right">{total_wrapping}</td>
|
||||
</tr>
|
||||
<tr class="conf_body">
|
||||
<td bgcolor="#fbfbfb" align="right" colspan="4"><strong><?php echo t('Shipping'); ?></strong></td>
|
||||
<td bgcolor="#fbfbfb" align="right">{total_shipping}</td>
|
||||
</tr>
|
||||
<tr class="conf_body">
|
||||
<td bgcolor="#fbfbfb" align="right" colspan="4"><strong><?php echo t('Total Tax paid'); ?></strong></td>
|
||||
<td bgcolor="#fbfbfb" align="right">{total_tax_paid}</td>
|
||||
</tr>
|
||||
<tr class="conf_body">
|
||||
<td bgcolor="#fbfbfb" align="right" colspan="4" class="total"><strong><?php echo t('Total paid'); ?></strong></td>
|
||||
<td bgcolor="#fbfbfb" align="right" class="total_amount">{total_paid}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="box" colspan="3">
|
||||
<p>
|
||||
<?php echo t('Carrier:'); ?>
|
||||
</p>
|
||||
<span>
|
||||
{carrier}
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<table class="table">
|
||||
<tr>
|
||||
<td class="box" width="310">
|
||||
<p>
|
||||
<?php echo t('Delivery address'); ?>
|
||||
</p>
|
||||
<span>
|
||||
{delivery_block_html}
|
||||
</span>
|
||||
</td>
|
||||
<td width="20"> </td>
|
||||
<td class="box" width="310">
|
||||
<p>
|
||||
<?php echo t('Billing address'); ?>
|
||||
</p>
|
||||
<span>
|
||||
{invoice_block_html}
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="box" colspan="3">
|
||||
<p>
|
||||
<?php echo t('Customer message:'); ?>
|
||||
</p>
|
||||
<span>
|
||||
{message}
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php include ('footer.php'); ?>
|
||||
@@ -1,23 +0,0 @@
|
||||
<?php include ('header.php'); ?>
|
||||
|
||||
<tr>
|
||||
<td align="center">
|
||||
<span class="title"><?php echo t('Hi,'); ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="box">
|
||||
<p>
|
||||
<?php echo t('{product} is almost out of stock.'); ?>
|
||||
</p>
|
||||
<span>
|
||||
<?php echo t('The stock cover is now less than the specified minimum of:'); ?> <strong><span>{warning_coverage}.</span></strong><br /><br />
|
||||
<strong><span><?php echo t('Current stock cover:'); ?></span></strong> {current_coverage}
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php include ('footer.php'); ?>
|
||||
@@ -1,24 +0,0 @@
|
||||
<?php include ('header.php'); ?>
|
||||
|
||||
<tr>
|
||||
<td align="center">
|
||||
<span class="title"><?php echo t('Hi,'); ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="box">
|
||||
<p>
|
||||
<?php echo t('{product} is nearly out of stock.'); ?>
|
||||
</p>
|
||||
<span>
|
||||
<?php echo t('The remaining stock is now less than the specified minimum of'); ?> <strong><span>{last_qty}.</span></strong><br /><br />
|
||||
<strong><span><?php echo t('Remaining stock:'); ?></span></strong> {qty}<br/><br/>
|
||||
<?php echo t('You are advised to open the product's admin Product Page in order to replenish your inventory.'); ?>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php include ('footer.php'); ?>
|
||||
Reference in New Issue
Block a user