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

查看:66
本文介绍了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天全站免登陆