gpt4 book ai didi

php - 如何向 order_aggregated_created 表添加另一个属性?

转载 作者:行者123 更新时间:2023-11-29 02:01:18 26 4
gpt4 key购买 nike

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

我在 Reports->Sales->Orders 下扩展了销售报告,并创建了我自己的自定义过滤器以按 channel 归档报告。每个订单都有一个‘channel_name’属性来标识订单是否来自eBay、Amazon等。

现在我一辈子都弄不清楚用于生成报告的 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,然后继续我的快乐之旅,那就太棒了。

最佳答案

经过大量研究后发现 sales/order_aggregated_created 表是在这里生成的:

Mage_Sales_Model_Resource_Report_Order_Createdat

现在我以前看过这里似乎正是我需要的,但我所做的任何更改都不会反射(reflect)在 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

关于php - 如何向 order_aggregated_created 表添加另一个属性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14177680/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com