I am new to magento. I followed one tutorial and created one custom report. Report is working fine on local pc but after i deployed the report on live server it is not giving any error and showing blank page. Exception.log is showing the below trace
exception 'Mage_Core_Exception' with message 'Invalid block type: Mycompany_Mymodule_Block_Adminhtml_Mymodule' in /var/www/xxxx.com/httpdocs/app/Mage.php:595
app\code\local\Mycompany\Mymodule\etc\config.xml
*/
-->
<config>
<modules>
<Mycompany_Mymodule>
<version>0.1.0</version>
</Mycompany_Mymodule>
</modules>
<admin>
<routers>
<mymodule>
<use>admin</use>
<args>
<module>Mycompany_Mymodule</module>
<frontName>mymodule</frontName>
</args>
</mymodule>
</routers>
</admin>
<adminhtml>
<menu>
<report>
<children>
<mymodule translate="title" module="mymodule">
<title>Order Fullfillment Report</title>
<action>mymodule/adminhtml_mymodule</action>
</mymodule>
</children>
</report>
</menu>
<acl>
<resources>
<all>
<title>Allow Everything</title>
</all>
<admin>
<children>
<report>
<children>
<mymodule translate="title" module="mymodule">
<title>Mymodule Report</title>
<action>mymodule/adminhtml_mymodule</action>
</mymodule>
</children>
</report>
</children>
</admin>
</resources>
</acl>
<layout>
<updates>
<mymodule>
<file>mymodule.xml</file>
</mymodule>
</updates>
</layout>
</adminhtml>
<global>
<models>
<mymodule>
<class>Mycompany_Mymodule_Model</class>
<resourceModel>mymodule</resourceModel>
</mymodule>
</models>
<resources>
<mymodule_setup>
<setup>
<module>Mycompany_Mymodule</module>
</setup>
<connection>
<use>core_setup</use>
</connection>
</mymodule_setup>
<mymodule_write>
<connection>
<use>core_write</use>
</connection>
</mymodule_write>
<mymodule_read>
<connection>
<use>core_read</use>
</connection>
</mymodule_read>
</resources>
<blocks>
<mymodule>
<class>Mycompany_Mymodule_Block</class>
</mymodule>
</blocks>
<helpers>
<mymodule>
<class>Mycompany_Mymodule_Helper</class>
</mymodule>
</helpers>
</global>
</config>
\app\etc\modules\Mycompany_Mymodule.xml
<?xml version="1.0"?>
<config>
<modules>
<Mycompany_Mymodule>
<active>true</active>
<codePool>local</codePool>
</Mycompany_Mymodule>
</modules>
</config>
app\design\adminhtml\default\default\layout\mymodule.xml
<?xml version="1.0"?>
<layout version="0.1.0">
<mymodule_adminhtml_mymodule_index>
<reference name="content">
<block type="mymodule/adminhtml_mymodule" name="mymodule" />
</reference>
</mymodule_adminhtml_mymodule_index>
</layout>
app\code\local\Mycompany\Mymodule\Model\Mymodule.php
<?php
class Mycompany_Mymodule_Model_Mymodule extends Mage_Reports_Model_Mysql4_Order_Collection
{
function __construct() {
parent::__construct();
$this->setResourceModel('sales/order_item');
$this->_init('sales/order_item','item_id');
}
public function setDateRange($from, $to) {
$this->_reset();
$this->getSelect()->reset()
->from(
array('sf' => 'V_Order_Fullfillment_Report2'),
array(
'1DayC' => '(sum(sf.1DayC))',
'1DayP' => '(sum(sf.1DayP))',
'2DayC' => '(sum(sf.2DayC))',
'2DayP' => '(sum(sf.2DayP))',
'3DayC' => '(sum(sf.3DayC))',
'3DayP' => '(sum(sf.3DayP))',
'4DayC' => '(sum(sf.4DayC))',
'4DayP' => '(sum(sf.4DayP))',
'5DayC' => '(sum(sf.5DayC))',
'5DayP' => '(sum(sf.5DayP))',
'5pDayC' => '(sum(sf.5pDayC))',
'5pDayP' => '(sum(sf.5pDayP))',
'New_Orders' => '(count(sf.increment_id))'
))
->where("sf.created_at BETWEEN '".$from."' AND '".$to."'")
;
// uncomment next line to get the query log:
// Mage::log('SQL: '.$this->getSelect()->__toString());
return $this;
}
public function setStoreIds($storeIds)
{
return $this;
}
}
?>
app\code\local\Mycompany\Mymodule\Block\adminhtml\Mymodule\Grid.php
<?php
class Mycompany_Mymodule_Block_Adminhtml_Mymodule_Grid extends Mage_Adminhtml_Block_Report_Grid {
public function __construct() {
parent::__construct();
$this->setId('mymoduleGrid');
$this->setDefaultSort('created_at');
$this->setDefaultDir('ASC');
$this->setSaveParametersInSession(true);
$this->setSubReportSize(false);
}
protected function _prepareCollection() {
parent::_prepareCollection();
$this->getCollection()->initReport('mymodule/mymodule');
return $this;
}
protected function _prepareColumns() {
$this->addColumn('New_Orders', array(
'header' =>Mage::helper('reports')->__('New Orders'),
'align' =>'right',
'index' =>'New_Orders',
'total' =>'sum',
'type' =>'number'
));
$this->addColumn('1DayC', array(
'header' =>Mage::helper('reports')->__('1Day Complete'),
'align' =>'right',
'index' =>'1DayC',
'total' =>'sum',
'type' =>'number'
));
$this->addColumn('1DayP', array(
'header' =>Mage::helper('reports')->__('1Day Partial'),
'align' =>'right',
'index' =>'1DayP',
'total' =>'sum',
'type' =>'number'
));
$this->addColumn('2DayC', array(
'header' =>Mage::helper('reports')->__('2Day Complete'),
'align' =>'right',
'index' =>'2DayC',
'total' =>'sum',
'type' =>'number'
));
$this->addColumn('2DayP', array(
'header' =>Mage::helper('reports')->__('2Day Partial'),
'align' =>'right',
'index' =>'2DayP',
'total' =>'sum',
'type' =>'number'
));
$this->addColumn('3DayC', array(
'header' =>Mage::helper('reports')->__('3Day Complete'),
'align' =>'right',
'index' =>'3DayC',
'total' =>'sum',
'type' =>'number'
));
$this->addColumn('3DayP', array(
'header' =>Mage::helper('reports')->__('3Day Partial'),
'align' =>'right',
'index' =>'3DayP',
'total' =>'sum',
'type' =>'number'
));
$this->addColumn('4DayC', array(
'header' =>Mage::helper('reports')->__('4Day Complete'),
'align' =>'right',
'index' =>'4DayC',
'total' =>'sum',
'type' =>'number'
));
$this->addColumn('4DayP', array(
'header' =>Mage::helper('reports')->__('4Day Partial'),
'align' =>'right',
'index' =>'4DayP',
'total' =>'sum',
'type' =>'number'
));
$this->addColumn('5DayC', array(
'header' =>Mage::helper('reports')->__('5Day Complete'),
'align' =>'right',
'index' =>'5DayC',
'total' =>'sum',
'type' =>'number'
));
$this->addColumn('5DayP', array(
'header' =>Mage::helper('reports')->__('5Day Partial'),
'align' =>'right',
'index' =>'5DayP',
'total' =>'sum',
'type' =>'number'
));
$this->addColumn('5pDayC', array(
'header' =>Mage::helper('reports')->__('5+Day Complete'),
'align' =>'right',
'index' =>'5pDayC',
'total' =>'sum',
'type' =>'number'
));
$this->addColumn('5pDayP', array(
'header' =>Mage::helper('reports')->__('5+Day Partial'),
'align' =>'right',
'index' =>'5pDayP',
'total' =>'sum',
'type' =>'number'
));
$this->addExportType('*/*/exportCsv', Mage::helper('mymodule')->__('CSV'));
$this->addExportType('*/*/exportXml', Mage::helper('mymodule')->__('XML'));
return parent::_prepareColumns();
}
public function getRowUrl($row) {
return false;
}
public function getReport($from, $to) {
if ($from == '') {
$from = $this->getFilter('report_from');
}
if ($to == '') {
$to = $this->getFilter('report_to');
}
$totalObj = Mage::getModel('reports/totals');
$totals = $totalObj->countTotals($this, $from, $to);
$this->setTotals($totals);
$this->addGrandTotals($totals);
return $this->getCollection()->getReport($from, $to);
}
}
app\code\local\Mycompany\Mymodule\Block\adminhtml\Mymodule.php
<?php
class Mycompany_Mymodule_Block_Adminhtml_Mymodule extends Mage_Adminhtml_Block_Widget_Grid_Container {
public function __construct() {
$this->_controller = 'adminhtml_mymodule';
$this->_blockGroup = 'mymodule';
$this->_headerText = Mage::helper('mymodule')->__('Order Fullfillment Report');
parent::__construct();
$this->_removeButton('add');
}
}
app\code\local\Mycompany\Mymodule\Block\Mymodule.php
<?php
class Mycompany_Mymodule_Block_Mymodule extends Mage_Core_Block_Template {
public function _prepareLayout() {
return parent::_prepareLayout();
}
public function getMymodule() {
if (!$this->hasData('mymodule')) {
$this->setData('mymodule', Mage::registry('mymodule'));
}
return $this->getData('mymodule');
}
}
app\code\local\Mycompany\Mymodule\controllers\Adminhtml\MymoduleController.php
<?php
class Mycompany_Mymodule_Adminhtml_MymoduleController extends Mage_Adminhtml_Controller_Action {
protected function _initAction() {
$this->loadLayout();
return $this;
}
public function indexAction() {
$this->_initAction()
->renderLayout();
}
public function exportCsvAction() {
$fileName = 'mymodule.csv';
$content = $this->getLayout()->createBlock('mymodule/adminhtml_mymodule_grid')
->getCsv();
$this->_sendUploadResponse($fileName, $content);
}
public function exportXmlAction() {
$fileName = 'mymodule.xml';
$content = $this->getLayout()->createBlock('mymodule/adminhtml_mymodule_grid')
->getXml();
$this->_sendUploadResponse($fileName, $content);
}
protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream') {
$response = $this->getResponse();
$response->setHeader('HTTP/1.1 200 OK', '');
$response->setHeader('Pragma', 'public', true);
$response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
$response->setHeader('Content-Disposition', 'attachment; filename=' . $fileName);
$response->setHeader('Last-Modified', date('r'));
$response->setHeader('Accept-Ranges', 'bytes');
$response->setHeader('Content-Length', strlen($content));
$response->setHeader('Content-type', $contentType);
$response->setBody($content);
$response->sendResponse();
die;
}
}