2013-01-05 77 views
2

我一直在這個問題上摸索着我的頭腦。任何幫助或推動正確的方向將不勝感激。如何添加另一個屬性到order_aggregated_created表?

我已經在報告 - >銷售 - >訂單下擴展了銷售報告,並創建了我自己的自定義過濾器,以按渠道報告報告。 每個訂單都有一個'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,並在我的快樂方式。

回答

2

研究了很多,之後很多事實證明,銷售/ order_aggregated_created表被這裏產生:

Mage_Sales_Model_Resource_Report_Order_Createdat

現在我已經來過這裏看起來好像正是我需要的,但是任何的變化我所做的不會反映在Magento報告中,特別是在sales/order_aggregated_created表內。

我發現Mage_Sales_Model_Resource_Report_Order_Createdat僅在刷新Reports-> Sales-> Orders中的統計信息時才被調用,只有生成了NEW sales/order_aggregated_created表!因此,對於任何希望通過自定義屬性過濾訂單銷售報告的人,請查看:/app/code/core/Mage/Sales/Model/Resource/Report/Order/Createat.php

相關問題