Reporting Totals

nealsharmonnealsharmon Member
in Help edited March 2013
Is there a way to pull order totals for reporting purposes?

We have a total dollar amount and total number of orders on our home page...
www.orapup.com

We're building the same thing for FoxyCart and FoxyShop here...
www2.orapup.com

But the number is not dynamic. I was thinking to cache the total every hour and update the page. I only see a way to pull order lists in the api. Does anyone know of a way of pulling totals? I'd like to pull the all time number.

One more trick, we are running www2.orabrush.com on the same foxycart store. We add a custom_field of storename:orabrush.com or storename:orapup.com so that we can pull the correct numbers.

Any insights would be appreciated.
Comments
  • fc_adamfc_adam FoxyCart Team
    @nealsharmon,

    Good question.

    Currently the only way to get totals like that would be to loop over all of the transactions using the API. We don't have a totals value that you can access currently.

    That said though - looping over all of your transactions every hour or so would probably be overkill and becoming increasingly more cumbersome the more transactions you have.

    Perhaps a better approach would be to keep a running total using the XML datafeed. You could do it two ways, either create two entries in your database - one for total orders and one for total order price, and increment those with each order that comes in with the datafeed. The second approach would be to save some of the information from each order to your database, and then do an SQL query to your database to total the values based on that data. The first approach would be the simplest - but if you would have a need for more information/data, like getting orders since a certain date, the second approach would be the better approach.

    @sparkweb may have some FoxyShop specific suggestions for you too.
  • Two entries in the database with the datafeed is a good way to go. Thanks
Sign In or Register to comment.