Jump to content

MailAlert.php warning on every order


Recommended Posts

Every time a customer places an order, the following gets logged in my php error log:

 

PHP Warning:  Invalid argument supplied for foreach() in /home/domainname/public_html/modules/mailalerts/MailAlert.php on line 172

 

I looked at the line in question and I don't know what the problem is. I'm running Prestashop 1.5.4.1. Does anyone know what the problem is?

Link to comment
Share on other sites

No, emails were being sent just fine, that's what was weird. I eventually figured out that it was trying to use the table ps_mailalert_customer_oos, but this table only existed as an empty table named ps_mailalert_customer_oos_new. I have no idea how this happened... I'm guessing the autoupgrade script screwed up. I renamed the table and the errors have gone away. However, I've had 1 order since then and the table is still empty, so maybe the issue isn't quite resolved. I know this customer received an order confirmation email though because he replied to it.

Link to comment
Share on other sites

Thanks, if I have any issues with it I'll try that. For right now though it's still working and not giving me any errors. I didn't have any issues with it to begin with other than seeing the warning in my logs.

 

What is that foreach loop even doing if the customer receives the Order Confirmation email and I receive the New Order email?

Link to comment
Share on other sites

Haha wow... yeah I just double checked and both emails got sent out. I just grepped everything in my public_html directory for mailalert_customer_oos, and the only occurrence outside of the logs and the autoupgrade script is that one reference in MailAlert.php. So there's nothing that's inserting anything into it...

 

In the autoupgrade script (/autoupgrade/latest/prestashop/install/upgrade/php/update_mailalerts_add_column_idshop.ph

p), I did find this:

$installed &= Db::getInstance()->getValue('SHOW TABLES LIKE "'._DB_PREFIX_.'mailalert_cu
stomer_oos"');
...
if ($installed && !Db::getInstance()->execute('ALTER TABLE `'._DB_PREFIX_.'mailalert_cus
tomer_oos` ADD COLUMN `id_shop` int(11) NOT NULL default "0" AFTER `id_customer`'))

 

So it looks like it is adding a column called id_shop to the database, but I of course don't have that. The autoupgrade changelog references PSCFV-7688.

 

I'm going to try manually running the ALTER TABLE command and see what happens.

Link to comment
Share on other sites

×
×
  • Create New...