As Magento save coupon code on Sales_flat_Order table so you need to MySQL join with Sales_flat_order table
Add sales_flat_order table to collection.In magento, sales_flat_order and sales_flat_order_grid table related with Flat Grid order table entity_id and sales_flat_order table entity_id.
namespace Vendor\Module\Model\Plugin\Sales\Order;
class Grid {
public static $table = 'sales_order_grid';
/**
*
*/
public function afterSearch($intercepter, $collection) {
if ($collection->getMainTable() === $collection->getConnection()->getTableName(self::$table)) {
// retrieve where clause
$where = $collection->getSelect()->getPart(\Magento\Framework\DB\Select::WHERE);
// ...
// works with $where
// ...
// set the new where clause
$collection->getSelect()->setPart(\Magento\Framework\DB\Select::WHERE, $where);
}
return $collection;
}
}
Best Answer
You will need to override a class
Mage_Adminhtml_Block_Sales_Order_Create_Search_Grid
.Go to your config.xml and add this
Now create a file
Namespace/ModuleName/Block/Adminhtml/Sales/Order/Create/Search/Grid.php
and have this code:This will add a product type in grid.
Hope this helps. Good luck.