Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email

Magento Forum

How do I add another attribute to order_aggregated_created table? 
Jr. Member
Total Posts:  4
Joined:  2012-10-04

I’ve been scratching my head for days on this one. Any help or a push in the right direction would be greatly appreciated.

I’ve extended the sales report under Reports->Sales->Orders and created my own custom filters to filer the report by channels.
Each order has a ‘channel_name’ attribute to identify whether the order came from eBay, Amazon, etc.

Now I cannot for the life of me figure out how sales/order_aggregated_created table that is used to generate the reports is created. Where does the magic happen? I want to add ‘channel_name’ to the order_aggregated_created table to be able to filter by this attribute, but I cannot figure out how to this.

Diagram for order_aggregated_created table with its attributes:

Mage_Sales_Model_Resource_Report_Order_Collection is where the magic starts in retrieving the sales totals, particularly if I understood this correctly inside

protected function _getSelectedColumns(){...}

if (!$this->isTotals()) {
->_selectedColumns = array(
'period'                         => $this->_periodFormat,
'orders_count'                   => 'SUM(orders_count)',
'total_qty_ordered'              => 'SUM(total_qty_ordered)',
'total_qty_invoiced'             => 'SUM(total_qty_invoiced)',
'total_income_amount'            => 'SUM(total_income_amount)',
'total_revenue_amount'           => 'SUM(total_revenue_amount)',
'total_profit_amount'            => 'SUM(total_profit_amount)',
'total_invoiced_amount'          => 'SUM(total_invoiced_amount)',
'total_canceled_amount'          => 'SUM(total_canceled_amount)',
'total_paid_amount'              => 'SUM(total_paid_amount)',
'total_refunded_amount'          => 'SUM(total_refunded_amount)',
'total_tax_amount'               => 'SUM(total_tax_amount)',
'total_tax_amount_actual'        => 'SUM(total_tax_amount_actual)',
'total_shipping_amount'          => 'SUM(total_shipping_amount)',
'total_shipping_amount_actual'   => 'SUM(total_shipping_amount_actual)',
'total_discount_amount'          => 'SUM(total_discount_amount)',
'total_discount_amount_actual'   => 'SUM(total_discount_amount_actual)',

If would be awesome if I can just ‘channel_name’ =>$this->_channelName, and be on my merry way.

Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top