【问题标题】:When does catalogrule_product_price table get updated in relation to the product save in Magento?catalogrule_product_price 表何时更新与 Magento 中保存的产品相关的信息?
【发布时间】:2013-04-04 04:45:54
【问题描述】:

每次保存产品时,我都会尝试记录一些简单的数据,例如价格和目录规则价格。我已经设置了我的模块来处理catalog_product_save_after 事件,除了目录规则价格将价格拉到保存之前,一切似乎都运行良好。

为了进行测试,我尝试对catalogrule_product_price 表进行直接 MySQL 查询,但是当我查询时,其中的值似乎没有根据上次更改进行更新。保存后我直接检查 MySQL 并按预期更新。

我在Mage_CatalogRule_Model_Mysql4_Rule::_saveRuleProductPrices() 中找到了replace into 语句,但是当我尝试将我的直接sql 查询放在$this->_getWriteAdapter()->query($query); 之后时,我仍然得到旧的目录规则价格。

谁能指出我正确的方向?

来自模块的部分 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>

来自 etc/modules/MyCompany_All.xml 的部分调用...

<MyCompany_ProductLog>
    <active>true</active>
    <codePool>local</codePool>
    <depends>
        <Mage_CatalogRule />
    </depends>
</MyCompany_ProductLog>

【问题讨论】:

    标签: magento events observers


    【解决方案1】:

    没关系,这原来是我用来从 SQL 中提取数据的旧代码的问题。当我更新我们的方法以正确查询时,一切都按预期工作。糟糕!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多