Language Selection

简体中文English
Home About Us Company Blog EveBit fixes bug, contributing Magento development

EveBit fixes bug, contributing Magento development

09
Jul
2010

As a professional development team o

f Magento, EveBit recently fixes a bug exsting on the latest version of Magento: v1.4.0.1, it's about a problem in Lifetime Sales calculation.

 

The full disscusion can be seen at: http://www.magentocommerce.com/boards/viewthread/198624/, and following is the general description about this bug:

 

----------------------------------------------------------------------------------------------

 

I have a problem in Lifetime Sales calculation.

All orders grand total sum together is $6.2. But in the Dashboard, the Lifetime Sales is almost $238.80!!!! that is very strange,
so I checked the core code.

/app/code/core/Mage/Adminhtml/Block/Dashboard/Sales.php

the Lifetime Sales SQL statement is as below:

the problem I thought is in the SUM function in the SQL statement. the e.base_discount_amount in the SQL statement is a negative number(-59.4000).  so negative negative is positive. so here, actually, is e.base_subtotal(60.0000) - discount_amount(-59.4000). I have 7 orders, 5 orders are free, not need to pay. the two paid orders are the same.
finally:

Lifetime Sales = (e.base_subtotal(60.0000) - discount_amount(-59.4000)) * 2;
Average Orders = Lifetime Sales / 7

I also check the Shipping Cart Price Rules, action tab, the Discount amount is a positive value, and the Apply is set to percentage of product price discount
so, does anyone can tell me why the Lifetime Sales is so far to the actually grand total?

Do I misunderstanding the meaning of Lifetime Sales or set the wrong Shipping Cart Price Rules?

Thanks in advance.

 

----------------------------------------------------------------------------------------------

----------------------------------------------------------------------------------------------

 

Solution:

In the file:

/app/code/local/Mage/Reports/Model/Mysql4/Order/Collection.php

 

line 204:
Original:
({{base_subtotal}}-IFNULL({{

base_subtotal_refunded}},0)-IFNULL({{base_subtotal_canceled}},0)I-FNULL({{base_discount_amount}},0)+IFNULL({{base_discount_refunded}},0))*{{base_to_global_rate}}


Modified:
({{base_subtotal}}-IFNULL({{base_subtotal_refunded}},0)-IFNULL({{base_subtotal_canceled}},0)+IFNULL({{base_tax_amount}},0)+IFNULL({{base_discount_amount}},0)+IFNULL({{base_discount_refunded}},0))*{{base_to_global_rate}}



line 205:
Original:
array('base_subtotal', 'base_to_global_rate', 'base_subtotal_refunded', 'base_subtotal_canceled','base_discount_amount','base_discount_refunded')


Modified:
array('base_subtotal', 'base_to_global_rate', 'base_subtotal_refunded', 'base_tax_amount', 'base_subtotal_canceled','base_discount_amount','base_discount_refunded')


line 209:

Original:
({{base_subtotal}}-IFNULL({{base_subtotal_refunded}},0)-IFNULL({{base_subtotal_canceled}},0)-IFNULL({{base_discount_amount}},0)+IFNULL({{base_discount_amount}},0))
修改后:
({{base_subtotal}}-IFNULL({{base_subtotal_refunded}},0)-IFNULL({{base_subtotal_canceled}},0)+IFNULL({{base_tax_amount}},0)+IFNULL({{base_discount_amount}},0)+IFNULL({{base_discount_amount}},0))

line 210:
Original:
array('base_subtotal', 'base_subtotal_refunded', 'base_subtotal_canceled','base_discount_amount','base_discount_refunded')
Modified:
array('base_subtotal', 'base_subtotal_refunded', 'base_tax_amount', 'base_subtotal_canceled','base_discount_amount','base_discount_refunded')  

All rights reserved. Republication or redistribution of EveBit content, including by framing or similar means, is expressly prohibited without the prior written consent.
About Us Portfolios Technical Competence Company Blog

avatar

EveBit Digital is a Professional PHP Outsourcing Company (CMMI3 on validation). We are expertise in State-of-the-Art Internet Solutions, dynamic web solutions, Multimedia and Graphics Design, Search Engine Optimization and offshore outsourcing services.

We have experienced team for Zend Framework, Magento, Joomla!, TYOO3, Drupal, WordPress, Facebook Applications, Mobile Applications, Cloud Computing Applications... We can ensure you a quality web development services with cost effective solutions in World Wide Web market.

Because we have the best combination of affordability and quality - you can be anywhere in the world and we will be able to establish an excellent working relationship with you.

Email: info[AT]evebit.com  Phone: +86-27-82701147  Online Inquiry: Send your inquiry by Inquiry Form

CMS Professionals

Our team provides full levels of CMS solutions from personal blog, small firm brochure to news portal and eCommerce. We are the few company in the world, who delivered commerical projects for all the major PHP based CMS systems such as WordPress, Joomla!, TYPO3 and Drupal.

Magento Professionals

We have world-class team for building multiple vendors eCommerce platform based on the cutting edge open source project Magento (http://www.magentocommerce.com)

Zend Framework

We have experienced team with strong foundation on building complex web-based application powered by Zend Framework (http://framework.zend.com)

Zend Certified Engineer

Some of our engineers passed the most authoritative certification: Zend Certified Engineer (ZCE)

鄂ICP备000358号