Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Call a block on home page through static block with content value as </p> <p>{{block type="catalog/product_list" name="product_listing" template="catalog/product/latest.phtml"}}</p> <p>or you can directly call this block on cms home , paste this</p> <p>{{block type="catalog/product_list" name="product_listing" template="catalog/product/latest.phtml" }}</p> <p>in your cms home page content.</p> <p>create a file in folder frontend/theme_folder/default/template/catalog/product as latest.phtml.</p> <p>Paste the below code in it as :</p> <h2>Latest Products</h2> <pre><code>&lt;?php $_productCollection = Mage::getResourceModel('reports/product_collection') -&gt;addAttributeToSelect('*') -&gt;setVisibility(array(2,3,4)) -&gt;setOrder('created_at', 'desc') -&gt;setPage(1, 4); ?&gt; &lt;?php $_iterator = 0; ?&gt; &lt;ul class="products-grid"&gt; &lt;?php foreach($_productCollection as $_product) : ?&gt; &lt;li class="item&lt;?php if( ++$_iterator == sizeof($_productCollection) ): ?&gt; last&lt;?php endif; ?&gt;"&gt; &lt;?php // Product Image ?&gt; &lt;a href="&lt;?php echo $_product-&gt;getProductUrl() ?&gt;" title="&lt;?php echo $this-&gt;stripTags($this-&gt;getImageLabel($_product, 'small_image'), null, true) ?&gt;" class="product-image"&gt;&lt;img src="&lt;?php echo $this-&gt;helper('catalog/image')-&gt;init($_product, 'small_image')-&gt;resize(135); ?&gt;" width="135" height="135" alt="&lt;?php echo $this-&gt;stripTags($this-&gt;getImageLabel($_product, 'small_image'), null, true) ?&gt;" /&gt;&lt;/a&gt; &lt;div class="product-shop"&gt; &lt;div class="f-fix"&gt; &lt;h2 class="product-name"&gt;&lt;a href="&lt;?php echo $_product-&gt;getProductUrl(); ?&gt;"&gt;&lt;?php echo $_product-&gt;getName(); ?&gt;&lt;/h2&gt; &lt;?php echo $this-&gt;getPriceHtml($_product, true) ?&gt; &lt;?php if($_product-&gt;isSaleable()): ?&gt; &lt;p&gt;&lt;button type="button" title="&lt;?php echo $this-&gt;__('Add to Cart') ?&gt;" class="button btn-cart" onclick="setLocation('&lt;?php echo $this-&gt;getAddToCartUrl($_product) ?&gt;')"&gt;&lt;span&gt;&lt;span&gt;&lt;?php echo $this-&gt;__('Add to Cart') ?&gt;&lt;/span&gt;&lt;/span&gt;&lt;/button&gt;&lt;/p&gt; &lt;?php else: ?&gt; &lt;p class="availability out-of-stock"&gt;&lt;span&gt;&lt;?php echo $this-&gt;__('Out of stock') ?&gt;&lt;/span&gt;&lt;/p&gt; &lt;?php endif; ?&gt; &lt;/div&gt; &lt;/div&gt; &lt;/li&gt; &lt;?php endforeach; ?&gt; &lt;/ul&gt; </code></pre> <p>Thats it you will be able to see the latest 4 product on home page. you can increase the number of product by increasing the ->setPage(1, 4); to your required number of product on home page.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload