April 08, 2020


Thinking Magento

M2Epro Multi Channel Extension - How To Add Information To Sales_Order_Grid

If you're running M2EPro's Multi Channel Extension for ebay, play, amazon extension and you would like to add some of that information to your Sales_Order_Grid to save time navigating through the M2EPro menus and grids, the following information may prove to be useful for you.

In this instance we are going to add the ebay username to the Sale_Order_Grid so that we can perform lookups by ebay username

Copy from your core files Mage_Adminhtml_Block_Sales_Order_Grid into local 

Find function _prepareCollection()

Under $collection = Mage::getResourceModel($this->_getCollectionClass());

Addd the following code


What we are doing here is joinging 3 tables in the databse together. 

The first table we join is m2epro_order and match it up to the order_id of our magento orders. From m2epro_order the data we want to get is the id column.

Then we join m2epro_order_item but comparing the m2epro_order.id with m2epro_order_item.order_id. From m2epro_order_item the data we want to get is the order_id column.

Using the above 2 joins you now have access to the m2epro orders, which can perform look ups in ebay, amazon, play.

For this example we only require ebay usernames, but you could perform a CONCAT on amazon and ebay usernames together.

The final join is looking in m2epro_ebay_order joining m2epro_ebay_order.order_id to m2epro_order_item.order_id. This gives us the data we require to place the usernames on the grid.

Now adding your column to the grid, go down to function _prepareColumns()

$this->addColumn('buyer_user_id', array(
'header' => Mage::helper('sales')->__('User Id'),
'index' => 'buyer_user_id',

Save. Job complete