Social Icons

twitterfacebookgoogle pluslinkedinemail

Monday 19 August 2013

How to set data custom phtml file and Add phtml file to another phtml file in magento


when you want to add .phtml file in other phtml file then you can use following code.


<?php echo $this->getLayout()->createBlock('catalog/product_price_template')->setTemplate('catalog/product/view/tierprices.phtml')->toHtml();?>

 when You need to set Data in phtml file when block is create like above. you can add folllowing code.

->setData('product', $_product);

you can use this like   


$this->getLayout()->createBlock('catalog/product_price_template')->setTemplate('catalog/product/view/tierprices.phtml')->setData('product', $_product)->toHtml();?>




No comments :

Post a Comment

 

Free Advertisement

Free Advertisement

Free Advertisement

Free Advertisement