List 8 latest products on homepage - Magento 1.9.2.1 -


i know question gets asked quite bit , seems straight forward can't seem find post states answer works.

there few solutions on how list products marked 'new from' date in backend , there solutions list latest products specific category need 8 added products catalog full stop.

currently manually adding products 'latest products' category id of 116

and have in content of home page cms page:

{{block type="catalog/product_list" name="home.catalog.product.list" alias="products_homepage" category_id="116" template="catalog/product/list-latest.phtml"}}  

then in list-latest.phtml template file, have code collection:

    <?php     $_productcollection=$this->getloadedproductcollection()->setpagesize(10);     $_productcollection->clear(); //this unset loaded items.     $_productcollection->getselect()->limit(10); //set new limit     $_productcollection->getselect()->reset(zend_db_select::order); //reset order     $_productcollection->getselect()->order('cat_index_position asc');//force order position in category     $_productcollection->load();     $_helper = $this->helper('catalog/output'); ?> 

and loops through collection , works fine need way latest products categories , automatically put latest 8 products on homepage.

is there way alter code this?

please try following code

place below code in home page via admin login cms->select home page-> design->layout update xml

 <block type="catalog/product_new" name="home.catalog.product.new" alias="product_new" template="catalog/product/new.phtml" after="cms_page">              <action method="addpriceblocktype">                  <type>bundle</type>                  <block>bundle/catalog_product_price</block>                  <template>bundle/catalog/product/price.phtml</template>              </action>               <action method="setcolumncount"><columns>4</columns></action>               <action method="setproductscount"><count>8</count></action>          </block>

the above code show new product 4 columns per row , total 8 product limit.

let me know if have query


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -