rob84 Posted January 29, 2014 Share Posted January 29, 2014 (edited) Hello. Mail alert module v.2.20, send mail "out of stock" every order placed, and totally ignoring the minimum quantity stock configured for alert.Example:Ipod: 10 pc.new order: -1 pc.total stock: 9 pc.Minimum quantity for sending alert: 3 pc.Mail sent (when it shouldn't).How can be fixed ?I think the code interested is in /modules/mailalerts/mailalerts.php public function hookUpdateQuantity($params) { global $cookie; if (is_object($params['product'])) $params['product'] = get_object_vars($params['product']); if (is_array($params['product']['name'])) $params['product']['name'] = $params['product']['name'][(int)Configuration::get('PS_LANG_DEFAULT')]; if (isset($params['product']['id_product'])) $params['product']['id'] = (int)$params['product']['id_product']; $qty = (int)$params['product']['quantity']; if ($qty <= (int)(Configuration::get('MA_LAST_QTIES')) AND !(!$this->_merchant_oos OR empty($this->_merchant_mails)) AND Configuration::get('PS_STOCK_MANAGEMENT')) { $templateVars = array( '{qty}' => $qty, '{last_qty}' => (int)(Configuration::get('MA_LAST_QTIES')), '{product}' => strval($params['product']['name']).(isset($params['product']['attributes_small']) ? ' '.$params['product']['attributes_small'] : '')); $id_lang = (is_object($cookie) AND isset($cookie->id_lang)) ? (int)$cookie->id_lang : (int)Configuration::get('PS_LANG_DEFAULT'); $iso = Language::getIsoById((int)$id_lang); if ($params['product']['active'] == 1){ if (file_exists(dirname(__FILE__).'/mails/'.$iso.'/productoutofstock.txt') AND file_exists(dirname(__FILE__).'/mails/'.$iso.'/productoutofstock.html')) Mail::Send((int)Configuration::get('PS_LANG_DEFAULT'), 'productoutofstock', Mail::l('Product out of stock', (int)Configuration::get('PS_LANG_DEFAULT')), $templateVars, explode(self::__MA_MAIL_DELIMITOR__, $this->_merchant_mails), NULL, strval(Configuration::get('PS_SHOP_EMAIL')), strval(Configuration::get('PS_SHOP_NAME')), NULL, NULL, dirname(__FILE__).'/mails/'); } } if ($this->_customer_qty AND $params['product']['quantity'] > 0) $this->sendCustomerAlert((int)$params['product']['id'], 0); } How can be fixed ?PS: 1.4.7.3Thank you. Edited January 30, 2014 by rob84 (see edit history) Link to comment Share on other sites More sharing options...
rob84 Posted January 30, 2014 Author Share Posted January 30, 2014 (edited) No one please ? $qty = (int)$params['product']['quantity']; if ($qty <= (int)(Configuration::get('MA_LAST_QTIES')) AND !(!$this->_merchant_oos OR empty($this->_merchant_mails)) AND Configuration::get('PS_STOCK_MANAGEMENT')) It seems that mail alert ignore the "MA_LAST_QTIES" option configured in BO, and send mail everytime. How to change to work properly ? Edited January 30, 2014 by rob84 (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now