[英]'news_from_date' in Magento
I am using the Magento API to make a product "New" with the following 我正在使用Magento API使用以下内容生成“新”产品
'news_from_date' => date("d/m/Y h:i:s");
using catalog_product.update
使用catalog_product.update
This works perfectly fine and shows the item as "New" 这完全正常,并将项目显示为“新”
However, I am now trying to make an item previously marked as "New" not to be new. 但是,我现在正试图使之前标记为“新”的项目不是新的。 I thought I could do this again with catalog_product.update and just making 我以为我可以使用catalog_product.update再次执行此操作
'news_from_date' => null;
But this only sets the date to - 30/11/1999 which obviously keeps the item as "New" Can someone point me in the right direction? 但这仅将日期设置为 - 30/11/1999,这显然使项目保持为“新”可以有人指出我正确的方向吗?
Edit 编辑
I have also tried the following with no joy - 我也试过以下没有喜悦 -
'news_from_date' => "00/00/00 00:00:00";
Thanks 谢谢
Magento SQL stores dates in this format: Magento SQL以这种格式存储日期:
yyyy-mm-dd hh:mm:ss
date("Ymd H:i:s");
So instead of: 所以代替:
'news_from_date' => "00/00/00 00:00:00";
'news_from_date' => date("d/m/Y h:i:s");
Use: 采用:
'news_from_date' => "0000-00-00 00:00:00";
'news_from_date' => date("Ymd H:i:s");
尝试将属性news_to_date
设置为上一个日期。
You can set the product date like that : 您可以设置产品日期:
$_product = Mage::getModel('catalog/product')->load($PRD_ID);
$_product->setData('news_from_date', date("d/m/Y h:i:s"));
$_product->setData('news_to_date', date("d/m/Y h:i:s", strtotime('+1 week')));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.