Pregunta

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

?>
¿Fue útil?

Solución

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');
Licenciado bajo: CC-BY-SA con atribución
No afiliado a magento.stackexchange
scroll top