这几天我一直在挠头。任何帮助或朝着正确方向的推动将不胜感激。
我在 Reports->Sales->Orders 下扩展了销售报告,并创建了我自己的自定义过滤器来按渠道归档报告。每个订单都有一个“channel_name”属性来识别订单是否来自 eBay、亚马逊等。
现在我无法弄清楚如何创建用于生成报告的 sales/order_aggregated_created 表。魔法发生在哪里?我想将“channel_name”添加到 order_aggregated_created 表中,以便能够按此属性进行过滤,但我无法弄清楚如何做到这一点。
order_aggregated_created 表及其属性的图表:http: //www.magento-exchange.com/wp-content/uploads/2010/11/MAGENTO-SALES-ORDER-ER.png
Mage_Sales_Model_Resource_Report_Order_Collection 是魔术开始检索销售总额的地方,特别是如果我在里面正确理解了这一点
protected function _getSelectedColumns(){...}
if (!$this->isTotals()) {
$this->_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)',
);
}
如果我可以'channel_name' =>$this->_channelName,并且走上我的快乐之路,那就太棒了。