【问题标题】:How do I add another attribute to order_aggregated_created table?如何向 order_aggregated_created 表添加另一个属性?
【发布时间】:2012-12-20 02:29:36
【问题描述】:

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

我在报告->销售->订单下扩展了销售报告,并创建了自己的自定义过滤器来按渠道归档报告。 每个订单都有一个“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 并且继续我的快乐之路,那就太棒了。

【问题讨论】:

    标签: php mysql magento


    【解决方案1】:

    经过大量研究,结果表明 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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-11-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-02-08
      • 1970-01-01
      相关资源
      最近更新 更多