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();

?>
Était-ce utile?

La 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');
Licencié sous: CC-BY-SA avec attribution
Non affilié à magento.stackexchange
scroll top