Search code examples
magentorenderer

How to render content of .phtml in controller and observer in magento


I have an observer "checkout_cart_add_product_complete"

I want to render the content of cart.phtml in observer and controller which is located in /template/ajaxminicart/checkout/cart.phtml

How can i do this?


Solution

  • Check following,

    <?php
    $newBlock =Mage::app()->getLayout()
    ->createBlock('checkout/cart')
    ->setTemplate('ajaxminicart/checkout/cart.phtml')
    -->toHtml();
    echo $newBlock;
    ?>