ezakimak Posted February 1, 2011 Share Posted February 1, 2011 Hi,recently we realized that there might be a bug in this module, for instance the reOrder part of the module, it always shows that 0 emails will be processed next time.Looking at the code of this method followup::reOrder($count)the sql sentence is wrong $emails = Db::getInstance()->ExecuteS(' SELECT o.id_order, c.id_cart, c.id_lang, cu.id_customer, cu.firstname, cu.lastname, cu.email FROM '._DB_PREFIX_.'orders o LEFT JOIN '._DB_PREFIX_.'customer cu ON (cu.id_customer = o.id_customer) LEFT JOIN '._DB_PREFIX_.'cart c ON (c.id_cart = o.id_cart) WHERE o.valid = 1 AND c.date_add >= DATE_SUB(CURDATE(),INTERVAL 7 DAY) AND o.id_order NOT IN (SELECT id_order FROM '._DB_PREFIX_.'log_email WHERE id_email_type = 2)'); the select id_order from ps_log_email where id_email_type = 2 , in ps_log_email there is no id_order column according to the code in method followup:install() public function install() { $logEmailTable = Db::getInstance()->Execute(' CREATE TABLE '._DB_PREFIX_.'log_email ( `id_log_email` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY , `id_email_type` INT UNSIGNED NOT NULL , `id_discount` INT UNSIGNED NOT NULL , `id_customer` INT UNSIGNED NULL , `id_cart` INT UNSIGNED NULL , `date_add` DATETIME NOT NULL ) ENGINE='._MYSQL_ENGINE_); foreach ($this->confKeys AS $key) Configuration::updateValue($key, 0); Configuration::updateValue('PS_FOLLOWUP_SECURE_KEY', strtoupper(Tools::passwdGen(16))); return parent::install(); } so, should I change (would it be safe?) the first sql sentence from $emails = Db::getInstance()->ExecuteS(' SELECT o.id_order, c.id_cart, c.id_lang, cu.id_customer, cu.firstname, cu.lastname, cu.email FROM '._DB_PREFIX_.'orders o LEFT JOIN '._DB_PREFIX_.'customer cu ON (cu.id_customer = o.id_customer) LEFT JOIN '._DB_PREFIX_.'cart c ON (c.id_cart = o.id_cart) WHERE o.valid = 1 AND c.date_add >= DATE_SUB(CURDATE(),INTERVAL 7 DAY) AND o.id_order NOT IN (SELECT id_order FROM '._DB_PREFIX_.'log_email WHERE id_email_type = 2)'); to $emails = Db::getInstance()->ExecuteS(' SELECT o.id_order, c.id_cart, c.id_lang, cu.id_customer, cu.firstname, cu.lastname, cu.email FROM '._DB_PREFIX_.'orders o LEFT JOIN '._DB_PREFIX_.'customer cu ON (cu.id_customer = o.id_customer) LEFT JOIN '._DB_PREFIX_.'cart c ON (c.id_cart = o.id_cart) WHERE o.valid = 1 AND c.date_add >= DATE_SUB(CURDATE(),INTERVAL 7 DAY) AND o.id_cart NOT IN (SELECT id_cart FROM '._DB_PREFIX_.'log_email WHERE id_email_type = 2)'); thanks for any input on thisregardsHugh 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