0
votes

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.

2

2 Answers

2
votes
$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
votes

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