-
- tilzinger

-
Total Posts: 126
Joined: 2007-12-27
|
I don’t have a sales_flat_order or sales_flat_invoice table. I’m still on Magento 1.3.2.4. Here is my entire file, it’s app/code/core/Mage/Adminhtml/Block/Sales/Invoice/Grid.php
class Mage_Adminhtml_Block_Sales_Invoice_Grid extends Mage_Adminhtml_Block_Widget_Grid {
public function __construct() { parent::__construct(); $this->setId('sales_invoice_grid'); $this->setDefaultSort('created_at'); $this->setDefaultDir('DESC'); }
protected function _prepareCollection() { //TODO: add full name logic $collection = Mage::getResourceModel('sales/order_invoice_collection') // ->addAttributeToSelect('email') ->addAttributeToSelect('order_id') ->addAttributeToSelect('increment_id') ->addAttributeToSelect('created_at') ->addAttributeToSelect('state') ->addAttributeToSelect('grand_total') ->addAttributeToSelect('order_currency_code') ->joinAttribute('billing_firstname', 'order_address/firstname', 'billing_address_id', null, 'left') ->joinAttribute('billing_lastname', 'order_address/lastname', 'billing_address_id', null, 'left') // ->joinAttribute('email', 'order_address/email', 'customer_id', null, 'left') ->joinAttribute('order_increment_id', 'order/increment_id', 'order_id', null, 'left') ->joinAttribute('order_created_at', 'order/created_at', 'order_id', null, 'left') ; // $collection = Mage::getResourceModel('sales/order_invoice_grid_collection'); // $collection->getSelect()->join(array('sfi'=>'sales_flat_invoice'),'main_table.entity_id=sfi.entity_id',array()); // $collection->getSelect()->join(array('sfo'=>'sales_flat_order'),'sfo.entity_id=sfi.order_id',array('sfo.customer_email')); // // $this->setCollection($collection);
$this->setCollection($collection); return parent::_prepareCollection(); }
protected function _prepareColumns() { // other columns here $this->addColumn('email', array( 'header' => Mage::helper('sales')->__('Customer Email'), 'sortable' => false, 'index' => 'email' )); // rest of the columns $this->addExportType('*/*/exportSalesCsv', Mage::helper('reports')->__('CSV')); $this->addExportType('*/*/exportSalesExcel', Mage::helper('reports')->__('Excel'));
return parent::_prepareColumns(); }
protected function _prepareMassaction() { $this->setMassactionIdField('entity_id'); $this->getMassactionBlock()->setFormFieldName('invoice_ids');
$this->getMassactionBlock()->addItem('pdfinvoices_order', array( 'label'=> Mage::helper('sales')->__('PDF Invoices'), 'url' => $this->getUrl('*/*/pdfinvoices'), ));
return $this; }
public function getRowUrl($row) { return $this->getUrl('*/*/view', array( 'invoice_id'=> $row->getId(), ) ); }
public function getGridUrl() { return $this->getUrl('*/*/*', array('_current' => true)); }
}
|