Magento catalog price rule disappears at night

前端 未结 5 1225
谎友^
谎友^ 2020-12-14 04:45

I have developed the online store on magento platform. Everything works fine except the Catalog price rule for sale. I have created the simple rule that applies 15% discount

5条回答
  •  甜味超标
    2020-12-14 05:15

    Yes, this is a bug in Magento (or some logic beyond my understanding). When Magento displays products on frontend, it checks if there are catalog rules for this date. And the date used for this check is your local, so in your case GMT+5. However, when catalog rules are being applied, it uses GMT date. So that means that you aren't able to apply rules until 5 AM.

    The problem is in Mage_CatalogRule_Model_Action_Index_Refresh::execute() method. You will have to rewrite this function/class either in your extension, or via the local version of the file.

    File location: app/code/core/Mage/CatalogRule/Model/Action/Index/Refresh.php

    You have to replace line 121:

    $timestamp = $coreDate->gmtTimestamp('Today');
    

    with this line:

    $timestamp = Mage::app()->getLocale()->date(null, null, null, true)->get(Zend_Date::TIMESTAMP);
    

    After that you should be able to apply the rules.

提交回复
热议问题