1

I have a custom grid that show all information of save CC method per order.

protected function _prepareCollection()
    {
        $collection = Mage::getModel('sales/order_payment')->getCollection();
        $collection->addFieldToFilter('method', array('in' => array('ccsave', 'ccsaveins')));

        $columns = array(
            'parent_id',
            'cc_exp_month',
            'method',
            'cc_last4',
            'cc_owner',
            'cc_type',
            'cc_exp_year',
            'cc_bankname',
            'cc_nom',
        );
        $collection->addFieldToSelect($columns);

        $collection->getSelect()->joinLeft(Mage::getConfig()->getTablePrefix().
            'sales_flat_order', 'main_table.parent_id ='.Mage::getConfig()->getTablePrefix().
            'sales_flat_order.entity_id',array('status', 'created_at', 'increment_id'));

        $this->setCollection($collection);
        return parent::_prepareCollection();
    }

Now I want to add a new column that define order has been invoiced or not, make it filterable. I don't know how to join to get result like that. Can anyone help me please ?.

I really really appreciate your help.

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.