I've successfully managed to create a custom report module in Magento following the (sort of) guide here Creating new completely custom reports
I have tried to add 6 columns to the report but it seems to be limited somewhere to only display 4 (both on the front end and csv export). If I remove some columns, the other ones show so they have been created corretly. Here's my grid;
class Juicy_Taxreport_Block_Adminhtml_Taxreport_Grid extends Mage_Adminhtml_Block_Report_Grid
{
public function __construct() {
parent::__construct();
$this->setId('taxreportGrid');
$this->setDefaultSort('created_at');
$this->setDefaultDir('ASC');
$this->setSaveParametersInSession(true);
$this->setSubReportSize(false);
}
protected function _prepareCollection() {
parent::_prepareCollection();
$this->getCollection()->initReport('taxreport/taxreport');
return $this;
}
protected function _prepareColumns() {
$this->addColumn('ordered_qty', array(
'header' =>Mage::helper('reports')->__('Quantity Ordered'),
'align' =>'right',
'index' =>'qty_ordered'
));
$this->addColumn('item_id', array(
'header' => Mage::helper('taxreport')->__('Item ID'),
'align' => 'right',
'index' => 'item_id'
));
$this->addColumn('store_id', array(
'header' => Mage::helper('taxreport')->__('Price'),
'align' => 'right',
'index' => 'base_original_price'
));
$this->addColumn('store_id', array(
'header' => Mage::helper('taxreport')->__('Tax Percent'),
'align' => 'right',
'index' => 'base_original_price'
));
$this->addColumn('store_id', array(
'header' => Mage::helper('taxreport')->__('Tax Amount'),
'align' => 'right',
'index' => 'tax_amount'
));
$this->addColumn('store_id', array(
'header' => Mage::helper('taxreport')->__('Tax Amount'),
'align' => 'right',
'index' => 'tax_amount'
));
$this->addExportType('*/*/exportCsv', Mage::helper('taxreport')->__('CSV'));
$this->addExportType('*/*/exportXml', Mage::helper('taxreport')->__('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');
}
return $this->getCollection()->getReport($from, $to);
}
}
In the example above, I can only see one of the tax related columns. If I remove, for example, the quantity column then I see two tax related columns. I have tried sifting through the extended classes but I can't seem to find anything there.