<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Magento product : display new product  icon on product list</title>
	<atom:link href="http://www.webmasterbulletin.net/2009/03/magento-product-display-new-product-icon-on-product-list/740/feed" rel="self" type="application/rss+xml" />
	<link>http://www.webmasterbulletin.net/2009/03/magento-product-display-new-product-icon-on-product-list/740?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=magento-product-display-new-product-icon-on-product-list</link>
	<description>Rambling around the web publishing industry</description>
	<lastBuildDate>Fri, 06 Jan 2012 19:20:22 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
	<item>
		<title>By: Kamil Węgrzynowicz</title>
		<link>http://www.webmasterbulletin.net/2009/03/magento-product-display-new-product-icon-on-product-list/740/comment-page-1#comment-5046</link>
		<dc:creator>Kamil Węgrzynowicz</dc:creator>
		<pubDate>Thu, 08 Dec 2011 08:58:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.webmasterbulletin.net/?p=740#comment-5046</guid>
		<description>You don&#039;t have to rewrite anything. And you really shouldn&#039;t put any code directly in Magento core. To add any attribute to the product collection just modify config.xml of any module or create XMl in app/etc/modules directory (name doesn&#039;t matter, because all XML files in this directory are merged by Magento) and put this code:


    
        
            
                
                    
                    
                
            
        
    


And that&#039;s it! No rewrite needed, just add it via XML</description>
		<content:encoded><![CDATA[<p>You don&#8217;t have to rewrite anything. And you really shouldn&#8217;t put any code directly in Magento core. To add any attribute to the product collection just modify config.xml of any module or create XMl in app/etc/modules directory (name doesn&#8217;t matter, because all XML files in this directory are merged by Magento) and put this code:</p>
<p>And that&#8217;s it! No rewrite needed, just add it via XML</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Naujasdizainas</title>
		<link>http://www.webmasterbulletin.net/2009/03/magento-product-display-new-product-icon-on-product-list/740/comment-page-1#comment-4193</link>
		<dc:creator>Naujasdizainas</dc:creator>
		<pubDate>Tue, 02 Mar 2010 00:54:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.webmasterbulletin.net/?p=740#comment-4193</guid>
		<description>Hi,
In list.phtml file top of file put this
_productCollection
-&gt;addAttributeToSelect(&#039;news_from_date&#039;)
-&gt;addAttributeToSelect(&#039;news_to_date&#039;);
?&gt;

and in place of example     
 after
htmlEscape($_product-&gt;getName()) ?&gt;&lt;/a&gt;
place you code
 getData(&#039;news_from_date&#039;),0,10);
$newsTo=  substr($_product-&gt;getData(&#039;news_to_date&#039;),0,10);
if ($now&gt;=$newsFrom &amp;&amp; $now NEW PRODUCT!</description>
		<content:encoded><![CDATA[<p>Hi,<br />
In list.phtml file top of file put this<br />
_productCollection<br />
-&gt;addAttributeToSelect(&#8216;news_from_date&#8217;)<br />
-&gt;addAttributeToSelect(&#8216;news_to_date&#8217;);<br />
?&gt;</p>
<p>and in place of example<br />
 after<br />
htmlEscape($_product-&gt;getName()) ?&gt;<br />
place you code<br />
 getData(&#8216;news_from_date&#8217;),0,10);<br />
$newsTo=  substr($_product-&gt;getData(&#8216;news_to_date&#8217;),0,10);<br />
if ($now&gt;=$newsFrom &amp;&amp; $now NEW PRODUCT!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jen</title>
		<link>http://www.webmasterbulletin.net/2009/03/magento-product-display-new-product-icon-on-product-list/740/comment-page-1#comment-4119</link>
		<dc:creator>jen</dc:creator>
		<pubDate>Thu, 19 Nov 2009 17:21:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.webmasterbulletin.net/?p=740#comment-4119</guid>
		<description>I still cannot get this to work.  Im a little bit of a novice when it comes to coding, can you explain where to put the coding?  and where to put this part:
echo (isProductNew($_product)) ? ‘New !’ : ”;

sorry, im so confused!</description>
		<content:encoded><![CDATA[<p>I still cannot get this to work.  Im a little bit of a novice when it comes to coding, can you explain where to put the coding?  and where to put this part:<br />
echo (isProductNew($_product)) ? ‘New !’ : ”;</p>
<p>sorry, im so confused!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mfauveau</title>
		<link>http://www.webmasterbulletin.net/2009/03/magento-product-display-new-product-icon-on-product-list/740/comment-page-1#comment-4081</link>
		<dc:creator>mfauveau</dc:creator>
		<pubDate>Thu, 22 Oct 2009 12:26:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.webmasterbulletin.net/?p=740#comment-4081</guid>
		<description>Turns out Wordpress screwed up the code... let me try again :
function isProductNew($product) {
	$todayDate = Mage::app()-&gt;getLocale()-&gt;date()-&gt;toString(Varien_Date::DATETIME_INTERNAL_FORMAT);
	if($todayDate &gt;= $product-&gt;getData(&#039;news_from_date&#039;) &amp;&amp; $todayDate &lt;= $product-&gt;getData(&#039;news_to_date&#039;)) 
	{
		return TRUE;
	}
	else
	{
		return FALSE;
	}
}</description>
		<content:encoded><![CDATA[<p>Turns out WordPress screwed up the code&#8230; let me try again :<br />
function isProductNew($product) {<br />
	$todayDate = Mage::app()-&gt;getLocale()-&gt;date()-&gt;toString(Varien_Date::DATETIME_INTERNAL_FORMAT);<br />
	if($todayDate &gt;= $product-&gt;getData(&#8216;news_from_date&#8217;) &amp;&amp; $todayDate &lt;= $product-&gt;getData(&#8216;news_to_date&#8217;))<br />
	{<br />
		return TRUE;<br />
	}<br />
	else<br />
	{<br />
		return FALSE;<br />
	}<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mfauveau</title>
		<link>http://www.webmasterbulletin.net/2009/03/magento-product-display-new-product-icon-on-product-list/740/comment-page-1#comment-4080</link>
		<dc:creator>mfauveau</dc:creator>
		<pubDate>Thu, 22 Oct 2009 12:20:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.webmasterbulletin.net/?p=740#comment-4080</guid>
		<description>You should not modify core Magento files. There is a way to do that whithout touching it.

In your /frontend/[you_template]/default/template/catalog/product/list.phtml add the following code to the top of the file :

--

$this-&gt;addAttribute(&#039;news_from_date&#039;); 
$this-&gt;addAttribute(&#039;news_to_date&#039;);
function isProductNew($product) {
	$todayDate = Mage::app()-&gt;getLocale()-&gt;date()-&gt;toString(Varien_Date::DATETIME_INTERNAL_FORMAT);
	$newsFrom = $product-&gt;getData(&#039;news_from_date&#039;);
	if($todayDate &gt;= $product-&gt;getData(&#039;news_from_date&#039;) &amp;&amp; $todayDate getData(&#039;news_to_date&#039;)) 
	{
		return TRUE;
	}
	else
	{
		return FALSE;
	}
}

--

Now you can test if the product is new by calling the function like : 

--

echo (isProductNew($_product)) ? &#039;New !&#039; : &#039;&#039;;

--</description>
		<content:encoded><![CDATA[<p>You should not modify core Magento files. There is a way to do that whithout touching it.</p>
<p>In your /frontend/[you_template]/default/template/catalog/product/list.phtml add the following code to the top of the file :</p>
<p>&#8211;</p>
<p>$this-&gt;addAttribute(&#8216;news_from_date&#8217;);<br />
$this-&gt;addAttribute(&#8216;news_to_date&#8217;);<br />
function isProductNew($product) {<br />
	$todayDate = Mage::app()-&gt;getLocale()-&gt;date()-&gt;toString(Varien_Date::DATETIME_INTERNAL_FORMAT);<br />
	$newsFrom = $product-&gt;getData(&#8216;news_from_date&#8217;);<br />
	if($todayDate &gt;= $product-&gt;getData(&#8216;news_from_date&#8217;) &amp;&amp; $todayDate getData(&#8216;news_to_date&#8217;))<br />
	{<br />
		return TRUE;<br />
	}<br />
	else<br />
	{<br />
		return FALSE;<br />
	}<br />
}</p>
<p>&#8211;</p>
<p>Now you can test if the product is new by calling the function like : </p>
<p>&#8211;</p>
<p>echo (isProductNew($_product)) ? &#8216;New !&#8217; : &#8221;;</p>
<p>&#8211;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nathan</title>
		<link>http://www.webmasterbulletin.net/2009/03/magento-product-display-new-product-icon-on-product-list/740/comment-page-1#comment-4057</link>
		<dc:creator>nathan</dc:creator>
		<pubDate>Thu, 08 Oct 2009 17:18:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.webmasterbulletin.net/?p=740#comment-4057</guid>
		<description>where does i put this ?
i didn&#039;t find ?

$now = date(”Y-m-d”);
$newsFrom= substr($_product-&gt;getData(’news_from_date’),0,10);
$newsTo=  substr($_product-&gt;getData(’news_to_date’),0,10);
if ($now&gt;=$newsFrom &amp;&amp; $now NEW PRODUCT!</description>
		<content:encoded><![CDATA[<p>where does i put this ?<br />
i didn&#8217;t find ?</p>
<p>$now = date(”Y-m-d”);<br />
$newsFrom= substr($_product-&gt;getData(’news_from_date’),0,10);<br />
$newsTo=  substr($_product-&gt;getData(’news_to_date’),0,10);<br />
if ($now&gt;=$newsFrom &amp;&amp; $now NEW PRODUCT!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sibble</title>
		<link>http://www.webmasterbulletin.net/2009/03/magento-product-display-new-product-icon-on-product-list/740/comment-page-1#comment-4040</link>
		<dc:creator>sibble</dc:creator>
		<pubDate>Thu, 01 Oct 2009 03:15:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.webmasterbulletin.net/?p=740#comment-4040</guid>
		<description>Had my doubts at first reading previous comment.  I had to try it for myself, and it indeed does work.

Two things:
1)  If you&#039;re copy/pasting the code, make sure to check the quote and double quote characters, may not be correct encoding.

2)  In your list.phtml, make sure your putting the logic in the correct listing type.  List is at the top, Grid is at the bottom.  Obviously you won&#039;t see any changes if you put the code in the List style type section and your store is displaying product as a Grid type.

Thanks for the code!</description>
		<content:encoded><![CDATA[<p>Had my doubts at first reading previous comment.  I had to try it for myself, and it indeed does work.</p>
<p>Two things:<br />
1)  If you&#8217;re copy/pasting the code, make sure to check the quote and double quote characters, may not be correct encoding.</p>
<p>2)  In your list.phtml, make sure your putting the logic in the correct listing type.  List is at the top, Grid is at the bottom.  Obviously you won&#8217;t see any changes if you put the code in the List style type section and your store is displaying product as a Grid type.</p>
<p>Thanks for the code!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nikl</title>
		<link>http://www.webmasterbulletin.net/2009/03/magento-product-display-new-product-icon-on-product-list/740/comment-page-1#comment-3975</link>
		<dc:creator>nikl</dc:creator>
		<pubDate>Fri, 21 Aug 2009 09:51:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.webmasterbulletin.net/?p=740#comment-3975</guid>
		<description>Which versions was this tested with? I cant get it to work wih 1.3.2! Where do I have to enter the code in the template file list.phtml? No matter where I enter it, the page will not be displayed or I will be getting an error message.</description>
		<content:encoded><![CDATA[<p>Which versions was this tested with? I cant get it to work wih 1.3.2! Where do I have to enter the code in the template file list.phtml? No matter where I enter it, the page will not be displayed or I will be getting an error message.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

