Magento 目录价格规则在晚上消失 [英] Magento catalog price rule disappears at night

查看:28
本文介绍了Magento 目录价格规则在晚上消失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 magento 平台上开发了在线商店.除了用于销售的目录价格规则外,一切正常.我创建了一个简单的规则,对所有产品应用 15% 的折扣.当我保存并应用规则时,它可以正常工作一整天.但在晚上 12 点之后,销售就不再可见了.我试图通过单击应用规则来应用管理面板中的规则,但在晚上它甚至不允许我手动应用规则.我可以在第二天早上应用规则,它工作正常,但直到 12 点.

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 on all products. When I save and apply the rule, it works fine the whole day. But after 12 at night, the sale is no more visible. I tried to apply the rules from the admin panel by clicking on apply rules, but at night it does not even allow me to apply rules manually. I can apply the rule next day in the morning and the it works fine but again till 12 am.

我尝试了以下方法.我已经去掉了在产品上单独定义的特殊价格,所以销售只通过价格规则来实现.我已经设置了 cron 工作,但它在晚上也不起作用.我已经检查了规则的日期和时间.

I have tried the following. I have removed the special prices that were defined separately on products, so the sale is implemented only by price rule. I have set the cron job but it also does not work at night. I have check the date and timings for the rules.

我发现可能是因为时间设置.我正在使用 GMT+5.有什么办法可以让规则日夜有效.

I found that it could be because of time settings. I am using GMT+5. Is there anything that can be done to keep the rule working for day and night.

谢谢

推荐答案

是的,这是 Magento 中的一个错误(或一些超出我理解的逻辑).当 Magento 在前端显示产品时,它会检查此日期是否有目录规则.用于此检查的日期是您当地的日期,因此在您的情况下为 GMT+5.但是,当应用目录规则时,它使用 GMT 日期.因此,这意味着您要到凌晨 5 点才能应用规则.

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.

问题出在 Mage_CatalogRule_Model_Action_Index_Refresh::execute() 方法中.您必须在扩展中或通过文件的本地版本重写此函数/类.

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.

文件位置:app/code/core/Mage/CatalogRule/Model/Action/Index/Refresh.php

您必须替换第 121 行:

You have to replace line 121:

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

用这一行:

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

之后,您应该能够应用规则.

After that you should be able to apply the rules.

这篇关于Magento 目录价格规则在晚上消失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆