Question

My block is not calling in shell script.

<?php
ini_set('display_errors', 1); 
require_once 'abstract.php';
class Mage_Shell_ReportMail extends Mage_Shell_Abstract{
    public function run(){
        Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
        echo Mage::app()->getLayout()->createBlock('adminhtml/template')->setTemplate('salesreport.phtml')->toHtml();
    }
}

$shell = new Mage_Shell_ReportMail();
$shell->run();

?>
Was it helpful?

Solution

It seems block was not taking correct template area and it was trying to find file in frontend area instead adminhtml.

Need to define template area for adminhtml so it will call from correct path.

 Mage::getDesign()->setArea('adminhtml');
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top