0

When I'm in: index.php/admin/sales_order/view/order_id/[ID]/key/[KEY]/ I can see the: "Items Ordered"

I'm looking for the code where the products are loaded in this table. I want to sort the ordered items by SKU.

Any hints?

PS: I was looking in app/code/core/Mage/Adminhtml/Block/Sales/Order/View but couldn't find anything.

Bob van Luijt
  • 7,153
  • 12
  • 58
  • 101

2 Answers2

2
$collection->getSelect()->join(array(
            'item'=>$collection->getTable('sales/order_item')),
            'item.order_id=`main_table`.entity_id AND item.product_type="simple"',
            array(
                'skus' => new Zend_Db_Expr('group_concat(item.sku SEPARATOR ", ")'),
                'name' => new Zend_Db_Expr('group_concat(item.name SEPARATOR ", ")')
            ));

$this->addColumn('skus', array(
            'header' => Mage::helper('sales')->__('SKU'),
            'index' => 'skus',
            'type' => 'text',
        ));

        $this->addColumn('name', array(
            'header' => Mage::helper('sales')->__('NAME'),
            'index' => 'name',
            'type' => 'text'
        ));
0

You can add SKU as an option in the Manage Attributes menu in Admin. Having done that, set it to be the default in System > Configuration > Catalog > Catalog > Product Listing Sort By.

try this alternatively you might like this

Rachel Gallen
  • 27,943
  • 21
  • 72
  • 81