Quote:
Originally Posted by jeremye
This can easily be accomplished by adding a few qualifying statements to the SQL query on Line 110 (or thereabouts): Delete the line where it starts with "$sql = "SELECT tblproducts..." and replace it with the following:
Code:
$sql = "SELECT tblproducts.product, tbldetails.productid, SUM(tbldetails.price*tbldetails.amount) AS total, SUM(tbldetails.amount) AS qty_purchased FROM xcart_order_details AS tbldetails, xcart_products AS tblproducts, xcart_orders AS tblorders WHERE tblproducts.productid=tbldetails.productid AND tbldetails.orderid=tblorders.orderid AND tblorders.date >= $start_date AND tblorders.date <= $end_date AND tblorders.status = 'C' OR tblorders.status = 'P' GROUP BY tbldetails.productid ORDER BY $report_type desc";
Notice that I added two statements:
Code:
AND tblorders.status = 'C' OR tblorders.status = 'P'
This makes sure it only counts orders that are Complete or Processed.
I have tested it on my side and it works fine. Let me know if this helps or not.
|
I am using 3.3.3 and the second sql didnot work. any help idea?