Note that there are some explanatory texts on larger screens.

plurals
  1. POMagento module to change dashboard graph
    primarykey
    data
    text
    <p>I am following along with this post <a href="https://stackoverflow.com/questions/14401516/change-the-dashboard-graph-in-version-1-7-1-12-of-magento">Change the Dashboard Graph in version 1.7/1.12 of Magento</a> to allow the sales of "processing" orders to show up on the dashboard graph. My files are below and within the right directories as well as showing up as active in config>advanced. I have also reindexed, refreshed cache, and refreshed lifetime statistics. I am seeing no errors in the logs. Can you see what is wrong? I have firegento and have enabled logging, but that's not working either.</p> <p>EDIT: The Revenue total on the dashboard seems correct, but its not reflecting on the timeline graph. For example there may be a net 30 terms order of $2000 at 10AM but it doesn't show on the time graph. Bounty for whoever can fix the script below to reflect on the timeline for me!</p> <p>CaitlinHavener/Dashboard/etc/config.xml:</p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;config&gt; &lt;modules&gt; &lt;CaitlinHavener_Dashboard&gt; &lt;version&gt;1.0&lt;/version&gt; &lt;/CaitlinHavener_Dashboard&gt; &lt;/modules&gt; &lt;global&gt; &lt;models&gt; &lt;CaitlinHavener_Dashboard&gt; &lt;class&gt;CaitlinHavener_Dashboard_Model&lt;/class&gt; &lt;/CaitlinHavener_Dashboard&gt; &lt;reports_resource&gt; &lt;rewrite&gt; &lt;order_collection&gt;CaitlinHavener_Dashboard_Model_Reports_Resource_Order_Collection&lt;/order_collection&gt; &lt;/rewrite&gt; &lt;/reports_resource&gt; &lt;/models&gt; &lt;/global&gt; &lt;/config&gt; </code></pre> <p>CaitlinHavener/Dashboard/Model/Reports/Resource/Order/Collection.php</p> <pre><code> &lt;?php /** * Show all orders, not only the invoiced one */ class CaitlinHavener_Dashboard_Model_Reports_Resource_Order_Collection extends Mage_Reports_Model_Resource_Order_Collection { protected function _prepareSummaryLive($range, $customStart, $customEnd, $isFilter = 0) { $this-&gt;setMainTable('sales/order'); $adapter = $this-&gt;getConnection(); /** * Reset all columns, because result will group only by 'created_at' field */ $this-&gt;getSelect()-&gt;reset(Zend_Db_Select::COLUMNS); /* $expression = sprintf('%s - %s - %s - (%s - %s - %s)', $adapter-&gt;getIfNullSql('main_table.base_total_invoiced', 0), $adapter-&gt;getIfNullSql('main_table.base_tax_invoiced', 0), $adapter-&gt;getIfNullSql('main_table.base_shipping_invoiced', 0), $adapter-&gt;getIfNullSql('main_table.base_total_refunded', 0), $adapter-&gt;getIfNullSql('main_table.base_tax_refunded', 0), $adapter-&gt;getIfNullSql('main_table.base_shipping_refunded', 0) ); */ $expression = sprintf('%s - %s - %s - (%s - %s - %s)', $adapter-&gt;getIfNullSql('main_table.base_total_invoiced', 'main_table.base_grand_total'), $adapter-&gt;getIfNullSql('main_table.base_tax_invoiced', 'main_table.base_tax_amount'), $adapter-&gt;getIfNullSql('main_table.base_shipping_invoiced', 'main_table.base_shipping_amount'), $adapter-&gt;getIfNullSql('main_table.base_total_refunded', 0), $adapter-&gt;getIfNullSql('main_table.base_tax_refunded', 0), $adapter-&gt;getIfNullSql('main_table.base_shipping_refunded', 0) ); if ($isFilter == 0) { $this-&gt;getSelect()-&gt;columns(array( 'revenue' =&gt; new Zend_Db_Expr( sprintf('SUM((%s) * %s)', $expression, $adapter-&gt;getIfNullSql('main_table.base_to_global_rate', 0) ) ) )); } else { $this-&gt;getSelect()-&gt;columns(array( 'revenue' =&gt; new Zend_Db_Expr(sprintf('SUM(%s)', $expression)) )); } $dateRange = $this-&gt;getDateRange($range, $customStart, $customEnd); $tzRangeOffsetExpression = $this-&gt;_getTZRangeOffsetExpression( $range, 'created_at', $dateRange['from'], $dateRange['to'] ); $this-&gt;getSelect() -&gt;columns(array( 'quantity' =&gt; 'COUNT(main_table.entity_id)', 'range' =&gt; $tzRangeOffsetExpression, )) //BOF modification -&gt;where('main_table.state NOT IN (?)', array( Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, // Mage_Sales_Model_Order::STATE_NEW ) ) //EOF modification -&gt;order('range', Zend_Db_Select::SQL_ASC) -&gt;group($tzRangeOffsetExpression); $this-&gt;addFieldToFilter('created_at', $dateRange); return $this; } protected function _calculateTotalsLive($isFilter = 0) { $this-&gt;setMainTable('sales/order'); $this-&gt;removeAllFieldsFromSelect(); $adapter = $this-&gt;getConnection(); // $baseTotalInvoiced = $adapter-&gt;getIfNullSql('main_table.base_grand_total', 0); // $baseTotalRefunded = $adapter-&gt;getIfNullSql('main_table.base_discount_refunded', 0); // $baseTaxInvoiced = $adapter-&gt;getIfNullSql('main_table.base_tax_amount', 0); // $baseTaxRefunded = $adapter-&gt;getIfNullSql('main_table.base_tax_refunded', 0); // $baseShippingInvoiced = $adapter-&gt;getIfNullSql('main_table.base_shipping_amount', 0); // $baseShippingRefunded = $adapter-&gt;getIfNullSql('main_table.base_shipping_refunded', 0); // $baseShippingRefunded = $adapter-&gt;getIfNullSql('main_table.base_shipping_refunded', 0); $baseTotalInvoiced = $adapter-&gt;getIfNullSql('main_table.base_total_invoiced', 'main_table.base_grand_total'); // This will check if there is no invoice it will calculate based on the grand totals ( so when you generate and invoice u will have no issues with the numbers also ) $baseTotalRefunded = $adapter-&gt;getIfNullSql('main_table.base_total_refunded', 0); $baseTaxInvoiced = $adapter-&gt;getIfNullSql('main_table.base_tax_invoiced', 'main_table.base_tax_amount'); // Same here for taxes $baseTaxRefunded = $adapter-&gt;getIfNullSql('main_table.base_tax_refunded', 0); $baseShippingInvoiced = $adapter-&gt;getIfNullSql('main_table.base_shipping_invoiced', 'main_table.base_shipping_amount'); // Same here for shipping $baseShippingRefunded = $adapter-&gt;getIfNullSql('main_table.base_shipping_refunded', 0); $revenueExp = sprintf('%s - %s - %s - (%s - %s - %s)', $baseTotalInvoiced, $baseTaxInvoiced, $baseShippingInvoiced, $baseTotalRefunded, $baseTaxRefunded, $baseShippingRefunded ); $taxExp = sprintf('%s - %s', $baseTaxInvoiced, $baseTaxRefunded); $shippingExp = sprintf('%s - %s', $baseShippingInvoiced, $baseShippingRefunded); if ($isFilter == 0) { $rateExp = $adapter-&gt;getIfNullSql('main_table.base_to_global_rate', 0); $this-&gt;getSelect()-&gt;columns( array( 'revenue' =&gt; new Zend_Db_Expr(sprintf('SUM((%s) * %s)', $revenueExp, $rateExp)), 'tax' =&gt; new Zend_Db_Expr(sprintf('SUM((%s) * %s)', $taxExp, $rateExp)), 'shipping' =&gt; new Zend_Db_Expr(sprintf('SUM((%s) * %s)', $shippingExp, $rateExp)) ) ); } else { $this-&gt;getSelect()-&gt;columns( array( 'revenue' =&gt; new Zend_Db_Expr(sprintf('SUM(%s)', $revenueExp)), 'tax' =&gt; new Zend_Db_Expr(sprintf('SUM(%s)', $taxExp)), 'shipping' =&gt; new Zend_Db_Expr(sprintf('SUM(%s)', $shippingExp)) ) ); } $this-&gt;getSelect()-&gt;columns(array( 'quantity' =&gt; 'COUNT(main_table.entity_id)' )) -&gt;where('main_table.state NOT IN (?)', array( Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, //Mage_Sales_Model_Order::STATE_NEW ) ); return $this; } } ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload