Magento Forum

   
How to get customer name on Transaction grid under sales menu ?? 
 
sarvagya
Jr. Member
 
Total Posts:  5
Joined:  2012-05-10
 

Hello,

I am trying to add column having customer name of each transaction on transactions grid. right now i am able to get customer first name and last name but in two separate columns. I am not getting how to do it.
It is very urgent Please help

 
Magento Community Magento Community
Magento Community
Magento Community
 
Tentura
Jr. Member
 
Avatar
Total Posts:  21
Joined:  2012-08-26
Germany
 

Looks like you using Customer colleciton. To select both names, in customer collection exists function addNameToSelect()

Mage::getModel('customer/customer')->getCollection()->addNameToSelect();

It will make possible to get “name” option, which will include combined First and Last names.

 
Magento Community Magento Community
Magento Community
Magento Community
 
sarvagya
Jr. Member
 
Total Posts:  5
Joined:  2012-05-10
 

Hello Tentura,
Thanks for the quick reply in this case, how i will use this in the collection i am having using sales/order_payment_transaction_Collection.
My function in transaction grid is :

protected function _prepareCollection()
{

$collection = ($this->getCollection())
? $this->getCollection() : Mage::getResourceModel(’sales/order_payment_transaction_collection’)
->addAttributeToSelect(’*’);

$order = Mage::registry(’current_order’);
if ($order) {
$collection->addOrderIdFilter($order->getId());
}

$collection->addOrderInformation(array(’increment_id’));
$collection->addPaymentInformation(array(’method’));

$collection->addOrderInformation(array(’customer_firstname’,’customer_lastname’,’customer_email’,’customer_id’,’’));

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

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top