I have the collection for transaction and I added a line to get customer_firstname:

  protected function _prepareCollection()
        $collection = ($this->getCollection())
            ? $this->getCollection() : Mage::getResourceModel('sales/order_payment_transaction_collection');
        $order = Mage::registry('current_order');
        if ($order) {
       $collection->joinAttribute('customer_firstname','sales_order/customer_firstname','sales_flat_order.increment_id=sales_payment_transaction.order_id', null,'inner',null);
        return parent::_prepareCollection();

here are the parameters for join attribute function:

    $filter = null, 
    $joinType = 'inner', 
    $storeId = null

so it seems I did not do anything wrong

and then when preparing columns I did this:

    protected function _prepareColumns()
             $this->addColumn('customer_firstname', array(
            'header' => Mage::helper('sales')->__('First Name'),
            'type'  => 'text'

It doesn't show me anything.how can i achieve this? I want to have the join

I don't want to go through the renderer because I know how to do it and I need to do it this way because I need to have filter in this new column


1 Answer 1


I'm noticing this.

sales_flat_order.increment_id = sales_payment_transaction.order_id

increment_id does not equate to order_id. Rather, it should like below.

sales_flat_order.entity_id = sales_payment_transaction.order_id

I typically prefer Zend methods.

    array('s' => $collection->getTable('sales/order')),
    'main_table.order_id = s.entity_id',
    array('customer_firstname' => 's.customer_firstname')

You should have customer_firstname available as a column on your collection now. Give it a shot!

  • Glad I could help!
    – laketuna
    Jul 12, 2015 at 5:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.