Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into bootstrap
Conflicts: admin-dev/themes/default/template/controllers/customer_threads/message.tpl admin-dev/themes/default/template/controllers/customers/helpers/view/view.tpl admin-dev/themes/default/template/controllers/import/helpers/form/form.tpl admin-dev/themes/default/template/controllers/modules/favorites.tpl admin-dev/themes/default/template/controllers/modules/list.tpl admin-dev/themes/default/template/controllers/modules/tab_module_line.tpl admin-dev/themes/default/template/controllers/modules_positions/list_modules.tpl admin-dev/themes/default/template/controllers/orders/_print_pdf_icon.tpl admin-dev/themes/default/template/controllers/orders/form.tpl admin-dev/themes/default/template/controllers/orders/helpers/view/view.tpl admin-dev/themes/default/template/controllers/products/associations.tpl admin-dev/themes/default/template/controllers/products/combinations.tpl admin-dev/themes/default/template/controllers/products/images.tpl admin-dev/themes/default/template/controllers/products/informations.tpl admin-dev/themes/default/template/controllers/products/prices.tpl admin-dev/themes/default/template/controllers/referrers/helpers/view/view.tpl admin-dev/themes/default/template/header.tpl admin-dev/themes/default/template/helpers/form/form.tpl admin-dev/themes/default/template/helpers/list/list_header.tpl classes/ProductSale.php classes/helper/HelperList.php controllers/admin/AdminCmsController.php controllers/admin/AdminCustomersController.php controllers/admin/AdminMetaController.php controllers/admin/AdminModulesController.php controllers/admin/AdminPerformanceController.php controllers/admin/AdminProductsController.php controllers/front/ParentOrderController.php install-dev/theme/views/welcome.phtml modules/blocknewproducts/blocknewproducts.php modules/blocktopmenu/blocktopmenu.php modules/importerosc/importerosc.php modules/mailalerts/mailalerts.php modules/shopimporter/shopimporter.php modules/statsstock/statsstock.php themes/default/css/product_list.css
This commit is contained in:
@@ -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')),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user