문제

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

?>
도움이 되었습니까?

해결책

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');
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 magento.stackexchange
scroll top