X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Custom Sales Reports by Product (item total and by qty) (https://forum.x-cart.com/showthread.php?t=7270)

abeight 04-23-2004 08:41 AM

The link above won't work anymore since I deleted the file and moved it to a password protected area. ;) I took lines 2-5 out, but still get the same error:

Code:

Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/bizplate/public_html/admin/report.php on line 2

Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/bizplate/public_html/admin/report.php on line 2

Parse error: parse error in /home/bizplate/public_html/admin/report.php on line 2


jeremye 04-23-2004 09:00 AM

Try replacing the first line with this (add just php)

Code:

<?php

I think it's a PHP setting with your server. We'll work it out...

jeremye 04-23-2004 09:09 AM

Quote:

Originally Posted by abeight
I took lines 2-5 out, but still get the same error


Anyone else want to chime in if you've seen this error before? I can only find these two links on PHP bugs, but can't really think up a solution:

http://bugs.php.net/bug.php?id=5387
http://bugs.php.net/bug.php?id=5448

abeight 04-23-2004 09:22 AM

LOL... well that was a step in the right direction. Now I only get the bottom two lines of the error. Thanks for trying to figure it out. Don't kill youself over it though. ;)

jeremye 04-23-2004 09:25 AM

Try doing a search and replace:

Find "<?"
Replace with "<?php"

See if that does anything.

jeremye 04-23-2004 11:16 AM

I did some more reading and it may be that 'magic_quotes_gpc' it turned OFF in your PHP settings. Let me know if you need help finding out how to check this.

rivermarinesupply 04-27-2004 07:39 AM

This picks up failed attempts as well, (which in my case really skews the order qty) is there anyway to have it only accept processed orders?

Thanks,
Eduardo.

jeremye 04-27-2004 08:39 AM

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.

jeremye 04-27-2004 08:43 AM

I forgot to mention another nice feature of this report. If you noticed, the X-Cart pre-packaged orders reports shows the total gross/paid amounts for the order date range you selected. Unfortunately, it adds shipping costs as well, so you are truly not generating the amount of revenue that x-cart claims you are. This report ONLY takes into account the product prices, not shipping, so you may notice a difference between this report and the reports that x-cart generates (this statement is valid up to version 3.4.14).

Just an FYI.

deniz 05-03-2004 10:31 AM

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?


All times are GMT -8. The time now is 05:28 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.