2

这几天我一直在挠头。任何帮助或朝着正确方向的推动将不胜感激。

我在 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,并且走上我的快乐之路,那就太棒了。

4

1 回答 1

3

经过大量研究,结果表明 sales/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 中的统计信息时才会被调用,然后才会生成一个新的 sales/order_aggregated_created 表!因此,对于希望通过自定义属性过滤订单销售报告的任何人,请查看内部:/app/code/core/Mage/Sales/Model/Resource/Report/Order/Createat.php

于 2013-01-06T07:56:31.957 回答