2012-01-21 133 views
1

一位客戶注意到她的系統中的管理儀表板計算與訂單報表不匹配,因爲所謂的「收入」實際上顯示的是利潤,如附圖所示。Magento管理儀表板修改

order report http://dl.dropbox.com/u/48637/CloudShot/shot_1212012_80701_pm.jpeg

我想要做的就是修改儀表盤頁面中加入這將是實際收入,而不是利潤5個元素。

我已經得到了添加元素到頁面。

admin dashboard http://dl.dropbox.com/u/48637/CloudShot/shot_1212012_80214_pm.jpeg

要做到這一點,我複製Totals.php從/應用程序/代碼/核心/法師/ Adminhtml /座/儀表板/到/應用/代碼/本地/法師/ Adminhtml /座/儀表板/。這是我修改的代碼:

$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,這些值會爲我工作一小段代碼..

$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') 
    )); 
+0

星期一早上顛簸......有人嗎? :) – nero

+0

評論不要碰到更高的問題。此外,我添加了一個「magento」標籤,因爲更多的人可能會看到這個標籤。 – clockworkgeek

+0

謝謝發條 – nero

回答

0

啓用日誌記錄在系統>配置>開發,然後旁邊的重寫代碼放:

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

觀看「無功/日誌/ System.log的」文件爲你刷新頁面,將傾倒$totals爲您服務。找到你想要的值的索引,並將其轉換爲駱駝大小寫,例如,如果你看到sales_total,那麼你可以使用$totals->getSalesTotal()(你已經嘗試過,這只是一個例子)。

記得在網站上線時關閉日誌記錄功能。

+0

本頁沒有其他變數。我正在更新我的問題與一些額外的信息 – nero