/**
  * Joins extra tables for adding custom columns to Mage_Adminhtml_Block_Sales_Order_Grid
  * @param Varien_Object $observer
  * @return Atwix_Exgrid_Model_Observer
  */
 public function salesOrderGridCollectionLoadBefore($observer)
 {
     $collection = $observer->getOrderGridCollection();
     $select = $collection->getSelect();
     $select->joinLeft(array('payment' => $collection->getTable('sales/order_payment')), 'payment.parent_id=main_table.entity_id', array('payment_method' => 'method'));
     $select->join('sales_flat_order_item_stitching', '`sales_flat_order_item_stitching`.order_id=`main_table`.entity_id', array('stitchingstatus_ids' => new Zend_Db_Expr('group_concat(`sales_flat_order_item_stitching`.stitchingstatus_id SEPARATOR ",")')));
     $select->group('main_table.entity_id');
 }
Example #2
0
 /**
  * Joins extra tables for adding custom columns to Mage_Adminhtml_Block_Sales_Order_Grid
  * @param Varien_Object $observer
  * @return Atwix_Exgrid_Model_Observer
  */
 public function salesOrderGridCollectionLoadBefore($observer)
 {
     $table = Mage::getSingleton("core/resource")->getTableName("sales_flat_order_item");
     $collection = $observer->getOrderGridCollection();
     $select = $collection->getSelect();
     $select->joinLeft(array('payment' => $collection->getTable('sales/order_payment')), 'payment.parent_id=main_table.entity_id', array('payment_method' => 'method'));
     $select->join($table, '`' . $table . '`.order_id=`main_table`.entity_id', array('skus' => new Zend_Db_Expr('group_concat(`' . $table . '`.sku SEPARATOR ", ")')));
     $select->group('main_table.entity_id');
 }