Magento – How to Set Up Instant Stock Update Email

stock

Magento does send an email to customer who registers for receiving email alert when a product comes back in stock. I noticed that email is not sent instant for only once a day.

Is it possible that email is sent to all the subscribed users as soon as the stock is updated from the backend?

Best Answer

I think the best way to solve your problem is setting the sending frequency higher. The sending frequency can be set from the backend (under System | Configuration | Catalog | Catalog | Product Alerts Run Settings), but only to once a day, once a week or once a month.

Now, if you look in Mage_Adminhtml_Model_System_Config_Backend_Product_Alert_Cron, you'll see that that's where the cron expression gets built and saved into the database in core_config_data.

You could modify this behaviour and create an extension that modifies the available dropdown values in the backend. You should add rewrites for Mage_Adminhtml_Model_System_Config_Source_Cron_Frequency to add the options and Mage_Adminhtml_Model_System_Config_Backend_Product_Alert_Cron to build the corresponding cron expressions.

A quick way to change the behaviour, is to edit the record with path crontab/jobs/catalog_product_alert/schedule/cron_expr in the table core_config_data. Most probably you'll find a record in the table with a value like 0 1 * * * (of not, enable product alerts in the backend, change the running time and save the section). You could edit it to match your needs, for instance 0 * * * * to send the alerts every hour. Beware that if you save the settings for the Catalog | Catalog section again in the backend, the custom settings you saved in the database are lost so you should only use this as a temporary solution.

Related Topic