I am calling a block method of another module in one of the .phtml file using below code--
Mage::app()->getLayout()->createBlock('tablisting/list')->toHtml();
this code works but it takes too much time in loading (approx.- 12 sec). When I dig it deeper I found toHtml() function which calling $this->renderView() in Mage_Core_Block_Template file. This line of code taking much time in loading.
Block file List.php -
protected function _toHtml(){
if(!$this->getConfig('isenabled')) return;
$is_ajax = Mage::app()->getRequest()->getParam('is_ajax');
if( $is_ajax ){
$cat_id = Mage::app()->getRequest()->getParam('tab_cat_id');
$order_id = Mage::app()->getRequest()->getParam('order_id');
$type = Mage::app()->getRequest()->getParam('data_type');
if( $type == 'order' ){
$child_items = $this->getProductsOrder($order_id);
} else {
$child_items = $this->getProducts($cat_id);
}
$template_file = 'sm/tablisting/default_items.phtml';
}else{
$template_file = 'sm/tablisting/default.phtml';
}
$this->setTemplate($template_file);
return parent::_toHtml();
}
Is there any other way to call that block method in my template file ? How can reduce loading time ? Please help me. Thanks in Advance.
$child_items
maybe that's the one that takes a lot of time (most likely the code is not the best code)