Fixed ecshop background order statistics inaccurate bugs

Source: Internet
Author: User
Tags php file

The order data in the ecshop background is not statistically correct, and the problem is defined in the order_status.php file function get_orderinfo ($start _date, $end _date), where all of the SQL uses the following code:

function Get_orderinfo ($start _date, $end _date)
{
$order _info = Array ();

/* Not confirmed order number * *
$sql = ' SELECT COUNT (*) as Unconfirmed_num from '. $GLOBALS [' ECS ']->table (' Order_info ').
"WHERE order_status = '". Os_unconfirmed. "' and Add_time >= ' $start _date '".
"And Add_time < '". ($end _date + 86400). "'";

Obviously, there's a very obvious logic error here, $end_date+86400, unless the user chooses a start and end time of the same day, there is no need to add 86400 (86,400 seconds equals 1 days), This error result will result in the last order count being not the data for the specified time period, but a day after the specified time.

In addition Ecshop itself the order confirmation function, resulting in the default Order statistics page, which shows only unconfirmed, confirmed, closed, invalid four information. None of these four information includes the most important information about the number of orders that have been paid

Simply change the useless confirmed order statistics code to the paid statistic code:

/* Confirmed order number */
    $sql = ' SELECT count (*) as Confirmed_num from '. $GLOBALS [' ECS ']->table (' Order_i NFO ').
           WHERE order_status = '. Os_confirmed. "' and Shipping_status not '. Db_create_in (Array (ss_shipped, ss_received)). "and Pay_status not". Db_create_in (Array (ps_payed, ps_paying)). " and Add_time >= ' $start _date '.
           "and Add_time <". ($end _date + 86400). "'";
    $order _info[' confirmed_num '] = $GLOBALS [' db ']->getone ($sql);
Change to:

/* by Tiandi number of orders paid/*
$sql = ' SELECT COUNT (*) as Confirmed_num from '. $GLOBALS [' ECS ']->table (' Order_info ').
"WHERE pay_status =". Ps_payed. " and Shipping_status not ". Db_create_in (Array (ss_shipped, ss_received)). " and Add_time >= ' $start _date '.
"And Add_time < $end _date";
$order _info[' confirmed_num '] = $GLOBALS [' db ']->getone ($sql);

You can repair the Ecshop statistics do not prepare the problem.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.