【问题标题】:Magento Admin Dashboard modificationMagento Admin Dashboard 修改
【发布时间】:2012-01-21 20:03:27
【问题描述】:

一位客户注意到她系统中的管理仪表板计算与订单报告不匹配,因为所谓的“收入”实际上是显示利润,如附图所示。

我想要做的是修改仪表板页面以添加第 5 个元素,这将是实际收入而不是利润。

我已经把元素添加到页面了。

为此,我将 Totals.php 从 /app/code/core/Mage/Adminhtml/Block/Dashboard/ 复制到 /app/code/local/Mage/Adminhtml/Block/Dashboard/。这是我修改的代码:

    $totals = $collection->getFirstItem();
    $this->addTotal($this->__('Revenue'), $totals->getProfit());
    $this->addTotal($this->__('Profit'), $totals->getRevenue());
    $this->addTotal($this->__('Tax'), $totals->getTax());
    $this->addTotal($this->__('Shipping'), $totals->getShipping());
    $this->addTotal($this->__('Quantity'), $totals->getQuantity()*1, true);

我似乎无法找到我需要调用的实际变量。有谁知道我如何找到它或它可能是什么?我试过 Sales、SalesTotal、Invoiced,它们都返回零。

这是在第一张图片中显示为销售总额的值。

谢谢。

编辑

我要查找的变量未加载到此文件中。我已经在 /app/code/core/Mage/Adminhtml/Block/Report/Sales/Sales/ 中找到了 Grid.php,这是在第一张图片中绘制表格的内容。

我试过插入

Mage::log($totals->debug());

在不同的地方,但它在每个实例中都会导致错误。

这是来自 Grid.php 的 sn-p 代码,这些值中的任何一个都对我有用..

$this->addColumn('total_income_amount', array(
        'header'        => Mage::helper('sales')->__('Sales Total'),
        'type'          => 'currency',
        'currency_code' => $currencyCode,
        'index'         => 'total_income_amount',
        'total'         => 'sum',
        'sortable'      => false
    ));

    $this->addColumn('total_revenue_amount', array(
        'header'        => Mage::helper('sales')->__('Revenue'),
        'type'          => 'currency',
        'currency_code' => $currencyCode,
        'index'         => 'total_revenue_amount',
        'total'         => 'sum',
        'sortable'      => false,
        'visibility_filter' => array('show_actual_columns')
    ));

【问题讨论】:

  • 周一早上要赶路……有人吗? :)
  • 评论不会让问题变得更高。我还添加了一个magento 标签,因为可能会有更多人看到它。

标签: magento-1.5 magento


【解决方案1】:

System > Configuration > Developer 中打开日志记录,然后在您覆盖的代码旁边放置:

Mage::log($totals->debug());

在刷新页面时观察“var/log/system.log”文件,它将为您转储$totals。找到您想要的值的索引并将其转换为驼峰式,例如如果您看到sales_total,那么您可以使用$totals->getSalesTotal()(您已经尝试过,这只是一个示例)。

记得在网站上线时关闭日志记录。

【讨论】:

  • 此页面上没有引入其他变量。我正在用一些额外的信息更新我的问题
猜你喜欢
  • 2013-05-18
  • 1970-01-01
  • 2021-08-31
  • 1970-01-01
  • 1970-01-01
  • 2020-10-24
  • 2020-06-15
  • 2014-10-12
  • 1970-01-01
相关资源
最近更新 更多