Magento – Magento Low Stock RSS has stopped refreshing

configurationinventorymagento-1.9rss

My Problem

Notify Low Stock RSS is not updating automatically. It is only updating feed data after I modify Configuration > Inventory > Product Stock Options.

I can confirm that Magento's cron job is running – not sure where to check to see whether or not the RSS part of that cron is running or not running.

Possible Cause:

A while back modified app/code/local/Mage/Rss/Block/Catalog/NotifyStock.php so that the pubDate is the date that the item went out of stock rather than the date the feed was generated. I don't think that this is the reason since the feed did update for a while after this change was made. Either way, my mod to the feed is below. The two modifications are /* commented */.

public function addNotifyItemXmlCallback($args)
{
    $product = $args['product'];
    $product->setData($args['row']);
    $url = Mage::helper('adminhtml')->getUrl('adminhtml/catalog_product/edit/',
        array('id' => $product->getId(), '_secure' => true, '_nosecret' => true));
    $qty = 1 * $product->getQty();
    $description = Mage::helper('rss')->__('%s has reached a quantity of %s.', $product->getName(), $qty);
    $rssObj = $args['rssObj'];

    /* Begin Modification */
    $resource = Mage::getSingleton('core/resource');
    $readConnection = $resource->getConnection('core_read');
    $tableName = $resource->getTableName('cataloginventory_stock_item');
    $getLowInventoryDate = 'SELECT low_stock_date FROM ' . $tableName .' where product_id='.$product->getId().' limit 1';
    $lowInventoryDate = $readConnection->fetchOne($getLowInventoryDate);
    /* End Mod */ 
    $data = array(
        'title'         => $product->getName(),
        'link'          => $url,
        'description'   => $description,
            /* Continue Mod */
        'lastUpdate' => strtotime($lowInventoryDate),
            /* End Mod */
    );
    $rssObj->_addEntry($data);
}

Best Answer

I don't see a reason for this. The block has a cache time out of 10 minutes, after these 10min you should get a new copy.

You should log the queries this block creates and make sure what they produce as output.

You can try to comment $this->setCacheLifetime(600); to get a fresh copy every time.

Related Topic