how to call app\design\frontend\base\default\template\checkout\cart\crosssell.phtml to app\code\local\Cmsmart\AjaxCart\controllers\IndexController\ in popup window

    if(@$product) $json_encode['ajaxcontinue'] = '
        <ul class="messages ajaxcart-messages">
            <li class="success-msg">
                    <li><span><a title="'.@$product->getName().'" href="'.@$product->getProductUrl().'">'.@$product->getName().' </a> '.$this->__('has been added to cart').'.</span></li>
                    <li><button onclick="setLocation(\''.Mage::getBaseUrl().'checkout/\')" class="button btn-continue" title="'.$this->__('Checkout').'" type="button"><span><span>'.$this->__('Checkout').'</span></span></button>


1 Answer 1


Just Call below code in popup it will load same phtml for you

<?php echo $this->getLayout()->createBlock('checkout/cart_crosssell')->‌​setTemplate('checkou‌​t/cart/crosssell.pht‌​ml')->setProduct($pr‌​oduct)->toHtml();?>
  • i got error like, " syntax error, unexpected 'checkout' (T_STRING) in app\code\local\Cmsmart\AjaxCart\controllers\IndexController.php on line 114"
    – Dhinakar
    Commented Aug 27, 2016 at 8:25
  • this module work only with checkout page , By the way where you are trying to fetch this block Commented Aug 27, 2016 at 8:28
  • that is my question i want to fetch block from other block, there is option for that
    – Dhinakar
    Commented Aug 27, 2016 at 8:32
  • For that you need to set product i think I am not sure its working or not but you can try <?php echo $this->getLayout()->createBlock('checkout/cart_crosssell')->setTemplate('checkout/cart/crosssell.phtml')->setProduct($product)->toHtml();?> Commented Aug 27, 2016 at 8:36
  • Where you create your popup ? At that place put this peice of code and your job is done Commented Aug 27, 2016 at 8:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.