1

In Magento 1's price indexer, the following method

#File: app/code/core/Mage/Catalog/Model/Product/Indexer/Price.php
public function matchEvent(Mage_Index_Model_Event $event)
{
    $data       = $event->getNewData();
    if (isset($data[self::EVENT_MATCH_RESULT_KEY])) {
        return $data[self::EVENT_MATCH_RESULT_KEY];
    }

    if ($event->getEntity() == Mage_Core_Model_Config_Data::ENTITY) {
        $data = $event->getDataObject();
        if ($data && in_array($data->getPath(), $this->_relatedConfigSettings)) {
            $result = $data->isValueChanged();
        } else {
            $result = false;
        }
    } elseif ($event->getEntity() == Mage_Customer_Model_Group::ENTITY) {
        $result = $event->getDataObject() && $event->getDataObject()->isObjectNew();
    } else {
        $result = parent::matchEvent($event);
    }

    $event->addNewData(self::EVENT_MATCH_RESULT_KEY, $result);

    return $result;
}

makes use of the _relatedConfigSettings property. This property contains the XML path to the cataloginventory/item_options/manage_stock System Configuration path via the Mage_CatalogInventory_Model_Stock_Item::XML_PATH_MANAGE_STOCK constant.

#File: app/code/core/Mage/Catalog/Model/Product/Indexer/Price.php
protected $_relatedConfigSettings = array(
    Mage_Catalog_Helper_Data::XML_PATH_PRICE_SCOPE,
    Mage_CatalogInventory_Model_Stock_Item::XML_PATH_MANAGE_STOCK
);

Does anyone here understand the reindexing process well enough to understand 1. What this matchEvent is used for and 2. Why does it need to reference the global manage stock configuration flag.

I can come up with several theories myself -- but I'm looking for concrete answers to save myself a few days of digging through the code.

1

I may be wrong, but AFAIK it uses stock reference to calculate the minimal price information for configurable/bundle/grouped products. Just to avoid to include out-of-stock products.

| 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.