4

I recently discovered my product stock alert e-mails aren't being sent. When I checked the cron_schedule table in my DB, I see the following:

cronfail

Which basically tells me there hasn't been any execution of this job since november 2014. Since this is a (fairly large) live site, I'd like to double check a few things. Would it be safe for me to change the following:

from config.xml in this path: app\code\core\Mage\ProductAlert\etc

<jobs>
   <catalog_product_alert>           
      <run>
     <model>productalert/observer::process</model>
  </run>
  </catalog_product_alert>
</jobs>

to

<jobs>
   <catalog_product_alert>
         <schedule>
     <cron_expr>* * * * *</cron_expr>
         </schedule>            
     <run>
     <model>productalert/observer::process</model>
  </run>
  </catalog_product_alert>

Since there have been thousands of product stock alert subscribers since that date.. I'm not quite sure if it is safe to do so.

EDIT: As for right now I'm starting to wonder if this is in fact the problem. I've checked the product_alert_stock table and it tells me the last e-mail was sent on june 7th, which is also not correct but maybe this particular cron catalog_product_alert is no longer used for this execution. Does anybody know wether this is true or not?

2

Install the AOE Scheduler for Magento https://github.com/AOEpeople/Aoe_Scheduler

It will show you if your cron setup is running properly and let you manually run cron jobs to test them. It is a very useful module for managing Magento cron tasks.

|improve this answer|||||
1

Firstly, you shouldn't ever modify core files, create your own extension with its config.xml.
You could wipe data for this cron from cron_schedule just to be sure the thousand of them don't get executed in the catch up Magento might do.

Also make sure your cron.php is executed on a regular basis (every 5 minutes or so).

|improve this answer|||||
  • I know that (about modifying core files), but thanks anyway. As for right now I'm starting to wonder if this is in fact the problem. I've checked the product_alert_stock table and it tells me the last e-mail was sent on june 7th, which is also not correct but maybe this particular cron catalog_product_alert is no longer used for this execution. – magin Jul 8 '15 at 15:02
  • I forgot to ask, does any other cron run on a regular basis? By that I mean are you sure your crons are actually running (I'm sure cron.php is because it fills your cron_schedule). – Julien Lachal Jul 9 '15 at 7:23
1

The cronjob catalog_product_alert is used to process the alert emails. For further details you can take a look at the module Mage_ProductAlert itself.

The cron time will be set in backend: System > Configuration > Catalog > Catalog > Product Alerts There is no need to add a cron_expr node to the config.xml

In general

You should monitor the cron_schedule table if the cronjob gets schedules:

select * from cron_schedule where job_code='catalog_product_alert'\G

You should take a look if the product is really set back to stock

select * from cataloginventory_stock_status where product_id=[??]

You should monitor the stock alert table for the test customer

select * from product_alert_stock where product_id=[??];

You can also write a little helper script to trigger the stock alert:

error_reporting(E_ALL | E_STRICT);
$mageFilename = 'app/Mage.php';
require_once $mageFilename;
Mage::setIsDeveloperMode(true);
ini_set('display_errors', 1);
umask(0);
Mage::app();

$foobar = new Mage_ProductAlert_Model_Observer;
$foobar->process();

echo "OK";

This should echo you potential issues. If the send_date get added to the table but you didn't receive an email, check spam folder and try with a different email address.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.