Foxy Forum Status

We're no longer responding to questions via our forum, but we will keep it up for historical reasons. If you can't find the answer you're looking for, please visit our knowledge base or contact us. If there's enough interest in the future, we may bring the forum back.

Donation Thermometer

in Help edited April 2014
I'm trying to figure out if there is an relatively simple way to implement a donation thermometer on our site. Essentially I would need to grab the total amount that has been donated to a specific product category and display it. Making the thermometer is not a problem. Grabbing the total amount purchased in a single category is where I'm a little lost. I'm betting it can be done with JSON and JQuery or the XML datafeed, but I could use a starting place or some pointers.

Domains are www.LCHS.info and www.pawprintscalendar.com.

Any help would be greatly appreciated! :)
Comments
  • fc_adamfc_adam FoxyCart Team
    @KaleidoscopeCastaway,

    Great question.

    So the best approach would be to utilise the XML datafeed - as that gets sent to your endpoint as soon as a successful donation is made. Here's a basic rundown of what you would do:

    Firstly, you would need to set up some sort of system on your side to track the total amount donated. That would probably be in a database of some sort, although it could be in a text file too as a raw number or the actual HTML that is displayed.

    Next, you would set up an endpoint on your server that accepts the XML datafeed. We have a starter script for that available on the wiki page at http://wiki.foxycart.com/static/redirect/xml_datafeed. What you would do within that script is loop through the products that are in the cart, checking to see if one is present within the specific category you're after. If it is, then you grab that products total price and update your amount figure in your database or file or wherever you're keeping track of it.

    You may also need to perform some further logic to update the page depending how you're tracking that.

    And that should be it. That approach would get your donation thermometer automatically updating live as people make donations to your site.

    Let us know if any of that is confusing!
Sign In or Register to comment.