Help me design a simple nutrition calculator for a restaurant website.
September 10, 2009 3:59 AM   Subscribe

How do I create a simple nutrition calculator for a restaurant website?

I'm working on a website for a restaurant chain.  What we would like to do is allow the customer to choose the ingredients he gets (it's a burrito place) and then he will get the nutritional value, preferably updated instantly as he picks new items.

Preferably it would work similar to the calculator on this page (I tried to email them about asking if we could use it, but got no answer).

I imagine this could be done with simple JavaScript, but I don't have the knowledge to write it myself. Are there any standard scripts out there I could use?
posted by einarorn to Computers & Internet (6 answers total) 1 user marked this as a favorite
There are a million different ways to do this (javascript, php, perl to name a few).
Here's a link to a very basic calorie calculator that could be very easily modified to do what you want.

Also, do you have all of your nutrition data? If not, here's the USDA's publicly accessible database.
posted by Cat Pie Hurts at 4:27 AM on September 10, 2009

I was just looking through the chipotle javascript, and it's pretty nice. Have you tried contacting the author, Matt Silverman, through his other site: It looks like that gets updated more frequently that the chipotle site, so the contact page may be more reliable.
posted by Cat Pie Hurts at 4:52 AM on September 10, 2009

Like you said, for instantly displayed results, javascript is the way you want to go with this. If you view the source on the Chipotle site, you might get an idea of how it was done (or it'll look like sanskrit). You have one array that contains all your data, and a form with some checkboxes that are associated with the data array. When you click a checkbox, the functions just grab the data in the array and add it to the nutrition box.

I thought someone might have done a how-to for jQuery, but Google is turning up nothing.
posted by backwards guitar at 5:26 AM on September 10, 2009

Wolfram Alpha also gives nutritional information.
posted by Obscure Reference at 5:29 AM on September 10, 2009

Response by poster: Just to clarify - Yes, I have all the nutrition information available. My question is just how I can allow our customers to calculate the values.

I just sent Matt another email to check again through his own website.

But if anyone has any links to publicly available scripts then that would be great. I can read the script and it makes sense to me, but I'd rather get it from somewhere that is publicly available.
posted by einarorn at 7:11 AM on September 10, 2009

Here's something that *might* guide you:

and here are the source files and a video screencast on the same calculator:

It's not exactly what you want, but should convert easily enough.
posted by backwards guitar at 7:23 AM on September 10, 2009

« Older What are these bugs?   |   This time, I ain't going dressed in toilet paper.... Newer »
This thread is closed to new comments.