When does catalogrule_product_price table get updated in relation to the product save in Magento?

StackOverflow https://stackoverflow.com/questions/15958107

  •  03-04-2022
  •  | 
  •  

I'm trying to log some simple data every time a product is saved such as price and catalog rule prices. I have set up my module to work off the catalog_product_save_after event and everything seems to be working fine except the catalogrule price which is pulling the price PRIOR to the save.

To test I have tried sticking in a direct MySQL query of the catalogrule_product_price table, but it appears the values in there haven't been updated based on the last change when I query it. After the save I check MySQL directly and it is updated as expected.

I found the replace into statement in Mage_CatalogRule_Model_Mysql4_Rule::_saveRuleProductPrices(), but when I tried placing my direct sql query right after the $this->_getWriteAdapter()->query($query); I'm still getting the old catalog rule price.

Can anyone point me in the right direction?

From part of the module's config.xml...

<adminhtml>
    <events>

        <catalog_product_save_after>
            <observers>
                <mycompany_productlog_observer>
                    <type>singleton</type>
                    <class>MyCompany_ProductLog_Model_Observer</class>
                    <method>catalog_product_save_after</method>
                </mycompany_productlog_observer>
            </observers>
        </catalog_product_save_after>

    </events>
</adminhtml>

Part of the call from the etc/modules/MyCompany_All.xml...

<MyCompany_ProductLog>
    <active>true</active>
    <codePool>local</codePool>
    <depends>
        <Mage_CatalogRule />
    </depends>
</MyCompany_ProductLog>
有帮助吗?

解决方案

Nevermind, this turned out to be an issue with the old code I was using to pull the data from SQL. When I updated our methods to query properly everything worked as expected. Oops!

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top