1

We have had product stock alerts in place and some customers have set up alerts. If we disable alerts what happens to existing alerts?

  • What do you mean by some customers have set up alerts ? what do you want to do exactly – PЯINCƏ Jul 10 '17 at 10:03
  • Some customers have set up product stock alerts for when items come back in stock. If we now disable alerting (config>sytem>catalog>product alerts) what happens to those alerts that have already been set up? Are they deleted? Are customers going to be left thinking they will get alerted but actually no emails will be sent? – jscar Jul 10 '17 at 10:09
  • Yes, if you disable it, customers will not be notified – PЯINCƏ Jul 10 '17 at 10:14
1

Short answer: Mail won't sent to anyone in any case.

Magento uses cronjobs to send out these alert emails. If you are interested in, you can check out the core module Mage_ProductAlert. Here you can see the cronjob is defined inside its config.xml file like this:

File : app\code\core\Mage\ProductAlert\etc\config.xml

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

Now if we check out productalert/observer::process() method. it looks like this:

File : app\code\core\Mage\ProductAlert\Model\Observer.php

public function process()
{
    $email = Mage::getModel('productalert/email');
    /* @var $email Mage_ProductAlert_Model_Email */
    $this->_processPrice($email);
    $this->_processStock($email);
    $this->_sendErrorEmail();

    return $this;
}

As you can see, $this->_processPrice($email)and $this->_processStock($email) is what we need to really looking into. In both these methods, you can see a checking like this:

productalert/observer::_processPrice()

if (!Mage::getStoreConfig(
     self::XML_PATH_PRICE_ALLOW,
     $website->getDefaultGroup()->getDefaultStore()->getId()
 )) {
     continue;
 }

productalert/observer::_processStock()

 if (!Mage::getStoreConfig(
     self::XML_PATH_STOCK_ALLOW,
     $website->getDefaultGroup()->getDefaultStore()->getId()
  )) {
      continue;
  }

As you can see, it checks whether the alert is enabled or not. If it is deactivated, it will not send emails.

PS: As soon as you enable it later, there is a chance to send out emails at that time. If you want to completely avoid this, you need to clear product_alert_price and product_alert_stock tables.

| improve this answer | |
  • Great answer @Rajeev. Can I just empty the product_alert_stock table or are there links to other tables that I need to consider? Is it best write some code to do this or can I just do it using sql? – jscar Jul 10 '17 at 10:14
  • 1
    if you truncate the tables in my answer then there won't be any emails sending any more. You don't need to touch any other tables. This is because Magento uses these tables internally to keep track and send product email alerts. It is safe to truncate those tables via a direct SQL query. Make sure it just truncate those two tables only. Never touch any other table or do not delete those two tables. Just truncate it. – Rajeev K Tomy Jul 10 '17 at 10:19

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.