Magento Forum

catalog/product/new.phtml inside the homepage using getLayout
 
sentuken
Jr. Member
 
Total Posts:  3
Joined:  2009-10-20
 

Hello,

I want to know how I can use the getLayout code to show the new.phtml inside my custom homepage. The easiest way is with

{{block type="catalog/product_new" name="home.catalog.product.new" alias="product_homepage" template="catalog/product/new.phtml"}}
inside your homepage in the admin panel, but it’s not what i’m looking for.

I tried this, but it didn’t work:

<?=$this->getLayout()->createBlock(‘catalog/product_new’,‘product_new’)->setTemplate(’catalog/new.phtml’)->toHtml()?>

Would appreciate any help. Thank you!

 
Magento Community Magento Community
Magento Community
Magento Community
 
kajal
Member
 
Total Posts:  60
Joined:  2010-06-27
 

Hello all,

If someone as well needs this answer :

<?php echo $this->getLayout()->createBlock('catalog/product_new')->setTemplate('catalog/product/new.phtml')->setCategoryId(2)->setColumnCount(2)->setProductsCount(4)->toHtml();?>

Hope this helps smile

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top