Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Custom Sales Reports by Product (item total and by qty)

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #51  
Old 02-15-2006, 08:22 AM
 
creative xpress creative xpress is offline
 

Advanced Member
  
Join Date: Aug 2005
Posts: 71
 

Default

I have resolved it. I was just being really stupid. here is my query now

Code:
$sql = "SELECT tblproducts.product, tblproducts.productcode, 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.productcode LIKE'$sku%' AND tblproducts.productid=tbldetails.productid AND tbldetails.orderid=tblorders.orderid AND tblorders.date >= $start_date AND tblorders.date <= $end_date AND tblorders.status != 'I' AND tblorders.status != 'D' AND tblorders.status != 'F' AND tblorders.status != 'Q' AND tblorders.status != 'B' GROUP BY tbldetails.productid ORDER BY $report_type desc";

Thanks for your help it works like a charm!
Cameron
__________________
Xcart
Version: 4.1.6
Reply With Quote
  #52  
Old 02-15-2006, 09:03 AM
 
jeremye jeremye is offline
 

Senior Member
  
Join Date: Apr 2004
Location: Philadelphia, PA
Posts: 158
 

Default

Try something like this:

Code:
$sql = "SELECT tblproducts.product, tblproducts.productcode, 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.productcode LIKE '" . $partial_sku . "%' AND tblproducts.productid=tbldetails.productid AND tbldetails.orderid=tblorders.orderid AND tblorders.date >= $start_date AND tblorders.date <= $end_date AND tblorders.status != 'I' AND tblorders.status != 'D' AND tblorders.status != 'F' AND tblorders.status != 'Q' AND tblorders.status != 'B' GROUP BY tbldetails.productid ORDER BY $report_type desc";

OR:

Code:
$sql = "SELECT tblproducts.product, tblproducts.productcode, 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.productcode = '" . $exact_sku . "' AND tblproducts.productid=tbldetails.productid AND tbldetails.orderid=tblorders.orderid AND tblorders.date >= $start_date AND tblorders.date <= $end_date AND tblorders.status != 'I' AND tblorders.status != 'D' AND tblorders.status != 'F' AND tblorders.status != 'Q' AND tblorders.status != 'B' GROUP BY tbldetails.productid ORDER BY $report_type desc";
__________________
Jeremy
X-Cart Gold v3.4.14 [Linux/Apache]
Heavily Modded
Reply With Quote
  #53  
Old 02-22-2006, 09:45 AM
 
TJ Stephens TJ Stephens is offline
 

Advanced Member
  
Join Date: May 2005
Location: California
Posts: 94
 

Default

Thank a lot for this mod. It works great. However, I am trying to modify it so that it only shows sales for a selected manufacturer. I would like to have a drop-down list of all the manufacturers and then limit the query/report to include only the products of the selected manufacturer.

Can anybody point me in the right direction on how to do a drop down list for the manufacturers and then take that selection and include it in the query. I'd appreciate any help.

Thanks a lot.

T.J.
__________________
X-Cart Pro 4.1.11 (Live)
XRMA
XAFF
XAOM
DSEFU Pro
XGift Reg
Firetank Feed Manager
BCSE Shipping Calculator
XcartMod Dynamic Images
Reply With Quote
  #54  
Old 02-28-2006, 07:27 AM
  2coolbaby's Avatar 
2coolbaby 2coolbaby is offline
 

eXpert
  
Join Date: Sep 2004
Location: TN moving to FL
Posts: 265
 

Default

All I get is a blank page. I have tried everything I can think of. I tried the code as given.

I removed the first 2 required lines. I added the php to the <?php as the rest of my php files have. I changed the requireds to the same thing listed in my store admin php files:

require "./auth.php";
require $xcart_dir."/include/security.php";

I have changed permissions from 644 to 755 and back. Nothing will allow this to show anything. Just a blank page.

I am using 4.0.17. As of now no biggee. But soon I will be going into boxed sets which will have high shipping charges. I pay percentage royalties to writers and artists so I will not want the shipping charges included.
__________________
Mary Lee
-------------------
Dinner and a Murder Mystery Games
http://www.dinnerandamurder.com

x-cart version 4.7.5 / Mac OS 10.10.5 and Windows 8/10 sometimes - Ideal Responsive Template
Reply With Quote
  #55  
Old 02-28-2006, 09:04 AM
 
jeremye jeremye is offline
 

Senior Member
  
Join Date: Apr 2004
Location: Philadelphia, PA
Posts: 158
 

Default

Mary Lee, sorry for the trouble you are having. Unfortunately I don't have a copy of the 4.x branch to play around with to test. Hopefully there are some other users who got it working in the 4.x branch to help you out...
__________________
Jeremy
X-Cart Gold v3.4.14 [Linux/Apache]
Heavily Modded
Reply With Quote
  #56  
Old 08-01-2007, 07:23 PM
 
mjfontec mjfontec is offline
 

Member
  
Join Date: Jul 2007
Posts: 14
 

Default Re: Custom Sales Reports by Product (item total and by qty)

Fantastic mod, thank you!!

Just wondering, is it possible to add a category name into this (or product variants)? I have a book available as paperback, hardcover, and ebook all with the same title, so they show up as the same product in the report. Tried the SKU, but could not get the sql query to work.

Thanks
Mike
__________________
X-cart Gold
v. 4.1.8
Unix
Reply With Quote
  #57  
Old 11-26-2007, 12:59 PM
 
smrtsu smrtsu is offline
 

Advanced Member
  
Join Date: Sep 2004
Posts: 34
 

Default Re: Custom Sales Reports by Product (item total and by qty)

I'm having difficulty connecting to my db using this mod.
I keep getting a connection string error. I'm running 4.0.19
__________________
smrtsu
xcart v4.0.17 http://www.ettasays.com
xcart v4.0.19 http://www.inspa.com
Reply With Quote
  #58  
Old 12-04-2007, 02:54 PM
 
stewbiedoobiedoo stewbiedoobiedoo is offline
 

Newbie
  
Join Date: Nov 2005
Posts: 4
 

Default Re: Custom Sales Reports by Product (item total and by qty)

I tested this script in 4.1.9 and it works great. I contacted x-cart and they wanted $290 to make this happen for us. The only changes I had to make was to comment out the first 4 lines (as mentioned above) change the year drop down menu (change 2003 to 2006 and 2006 to whichever year you want for future).

Works like a charm. Thank you so much!
__________________
Stewbiedoobiedoo
Reply With Quote
  #59  
Old 05-01-2008, 07:12 PM
 
ScrapOrchard ScrapOrchard is offline
 

eXpert
  
Join Date: Mar 2008
Posts: 243
 

Default Re: Custom Sales Reports by Product (item total and by qty)

This is fantastic! I wanted to know if anyone could help me figure out how to a) show the manufacturer b) show discounted/coupon totals (i.e. right now, we have a discounted product and the report is showing the total sales without taking into account the discount), c) subtract the discounted total from the total and d) be able to export is as a csv file?
__________________
www.scraporchard.com
X-Cart Pro Version 4.5.5

Altered Cart: One Page Checkout, OnSale, Buy Together, Download Expander, Smart Search, Shop by Filters
Gahela: Gahela Support System
The xCart Store: xBanners, xAccess, xMenus
Reply With Quote
  #60  
Old 06-23-2008, 06:12 AM
  Keys Care's Avatar 
Keys Care Keys Care is offline
 

eXpert
  
Join Date: Feb 2007
Location: Cheyenne - Santa Monica - Oregon
Posts: 214
 

Question Re: Custom Sales Reports by Product (item total and by qty)

Marvelous Tool!!!

I am wondering if there is an easy way to have the report sort by sku as an option.

I am also wondering if there is a way to search during a given period for shipping that is paid by the customers.

Thanks for the tool!

Regards,

Bob
__________________
All-Natural Healing Skin and Pet Care Products
4.6.0 Gold, ShipWorks 3
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 09:19 PM.

   

 
X-Cart forums © 2001-2020