Magento Forum

   
Page 2 of 2
unwanted automatic and resource consuming reindexing of price index after saving a product
 
VernBurton
Jr. Member
 
Total Posts:  23
Joined:  2011-02-22
Rochester, MN
 

You can replace the function in 1.5.0.1.

Copy
app/code/core/Mage/CatalogRule/Model/Rule.php
to
app/code/local/Mage/CatalogRule/Model/Rule.php

and replace the function as below around line 260

public function applyAllRulesToProduct($product)
    
{
        $this
->_getResource()->applyAllRulesForDateRange(NULLNULL$product);
        
$this->_invalidateCache();

        if (
$product instanceof Mage_Catalog_Model_Product{
            $productId 
$product->getId();
        
else {
            $productId 
$product;
        
}

        
if ($productId{
            Mage
::getResourceSingleton('catalog/product_indexer_price')->reindexProductIds(array($productId));
        
}
    }

 
Magento Community Magento Community
Magento Community
Magento Community
 
ivicaw
Jr. Member
 
Total Posts:  8
Joined:  2010-12-22
 

Hey guys what about a similar thing here, but for ver. 1.4.2 and for the “Manage Categories” instead??  . . . . I’m having a ‘HECK’ of a time trying to simply save my Manage Categories changes, and it should only usually just take a few ‘seconds’ actually, to save, but it’s taking minutes upon minutes to do.  Any might know a similar solution like that was in this post here, but for actually the save “Manage Categories” action instead??

Thanks!!!

-Ivica W.
==========
===========

 
Magento Community Magento Community
Magento Community
Magento Community
 
chiefair
Mentor
 
Avatar
Total Posts:  1839
Joined:  2009-06-04
 
VernBurton - 30 September 2011 10:42 AM

You can replace the function in 1.5.0.1.

Copy
app/code/core/Mage/CatalogRule/Model/Rule.php
to
app/code/local/Mage/CatalogRule/Model/Rule.php

and replace the function as below around line 260

public function applyAllRulesToProduct($product)
    
{
        $this
->_getResource()->applyAllRulesForDateRange(NULLNULL$product);
        
$this->_invalidateCache();

        if (
$product instanceof Mage_Catalog_Model_Product{
            $productId 
$product->getId();
        
else {
            $productId 
$product;
        
}

        
if ($productId{
            Mage
::getResourceSingleton('catalog/product_indexer_price')->reindexProductIds(array($productId));
        
}
    }

Modularized it, saves were taking 55-90 seconds depending on content

After loading the module, following

simple price change 6 seconds.

option price and title change 10 seconds.

changing a series of things in description, meta 20-30 seconds.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top
Page 2 of 2