Help - Search - Members - Calendar
Full Version: e-Commerce Shopping Cart help
HTMLHelp Forums > Web Authoring > Web Site Functionality
Building Smiles Fdtn
I am fairly new at creating shopping carts, etc so I am sure that I am doing something wrong with the code below. I was hoping someone could assist with what I am doing wrong. I was able to borrow the below code for my cart on Mal's e-Commerce, but not sure what is going on that I'm not able to make a payment.

If you go to my site http://www.buildingsmiles.org/3v3reg2.html you'll see there is a multiple drop down menu for our 3v3 Soccer Tournament, however once you click Register - you get "Error: userid not set"

Any ideas of what I have written in the code incorrectly? Thanks for your help!!!

I have attached the HTML/JS verbiage and will also reply to the post with it as well for those that can't pull up the attachment. It's long and therefore why I wanted to attach a doc.
Building Smiles Fdtn
----------------------------
<script type="text/javascript" src="dropdown-2.js"></script>
<script type="text/javascript">
function submitForm() {
/*
When the form is submitted, these fields are tested for blanks.
If it is ok to have a blank, then just remove that group.
Bear in mind though that if you remove a group here, you need to remove all references
to it in the rest of the page and to do this you would need good javascript knowledge
so that you don't remove wrong areas of code.
*/
if (document.myForm.Days.value=='') {
alert('Please Select No. of Days');
return false;
}
if (document.myForm.campArea.value=='select') {
alert('Please Select your Camp Area');
return false;
}
if (document.myForm.campSite.value=='select') {
alert('Please Select your Campsite');
return false;
}
if (document.myForm.noCampers.value=='') {
alert('Please Select number of Campers');
return false;
}
/*
If the above tests are all ok, then the script then creates the total
*/
sumFields();
}
function sumFields() {
/*
This function generates the price and product fields based on the users input.
The price is stored in a field called tmpPrice and is incremented as it goes down the script.
at the end of the script it is multiplied by the number of days and stored into the
forms price field.
The description is stored in a field called tmpDescription and like tmpPrice is built
as the script runs through. It is then stored into the forms product field.
*/
var tmpPrice=0;
var tmpField=0;
var tmpArray=new Array();
tmpField=document.myForm.campArea.value;
tmpArray = tmpField.split(':');
var tmpCampArea=tmpArray[0];
var tmpDescription='{b}'+tmpCampArea+document.myForm.campSite.value+'{/b}{br}'+document.myForm.Days.value+' Day';
if (document.myForm.Days.value>1) {
/*
All this next line of code does (and any others like it) is add an s to the end of the description
for more than one item.
*/
tmpDescription+='s';
}
tmpField=document.myForm.noCampers.value;
tmpArray = tmpField.split(':');
tmpDescription+='{br}'+tmpArray[0];
tmpPrice+=(1*tmpArray[1]);
/*
The following group of code (starting with if and ending with } ) is what is required for
all your drop boxes that contain a description and a price setout in the traditional way as
Mals productpr field.
Basically it first checks if the user has selected from the list and if so, runs the code.
It splits the field into two fields around the : symbol.
It then adds the first field ( tmpArray[0] ) to the temp field for description and adds the second
field ( tmpArray[1] ) to the temp field for price.
*/
if (document.myForm.addPadding.value>'') {
tmpField=document.myForm.addPadding.value;
tmpArray = tmpField.split(':');
tmpDescription+='{br}'+tmpArray[0];
tmpPrice+=(1*tmpArray[1]);
}
if (document.myForm.carpetSquares.value>'') {
tmpField=document.myForm.carpetSquares.value;
tmpArray = tmpField.split(':');
tmpDescription+=', '+tmpArray[0];
tmpPrice+=(1*tmpArray[1]);
}
if (document.myForm.gazebo.value>'') {
tmpField=document.myForm.gazebo.value;
tmpArray = tmpField.split(':');
tmpDescription+=', '+tmpArray[0];
tmpPrice+=(1*tmpArray[1]);
}
if (document.myForm.canopy.value>'') {
tmpField=document.myForm.canopy.value;
tmpArray = tmpField.split(':');
tmpDescription+=', '+tmpArray[0];
tmpPrice+=(1*tmpArray[1]);
}
/*
This next group of code is for check boxes.
It looks to see if it has been checked and if so, again adds to the description and price fields
*/
if (document.myForm.shelter.checked==1) {
tmpDescription+=', 3x3 Privacy Shelter';
tmpPrice+=(1*document.myForm.shelterPrice.value);
}
/*
This next group of code is for standard text boxes where you would normally ust qty.
It looks to see if it has entered a value and if so, multiplies it by the price for that
option and adds it to the tmpPrice field. Also adds in the description.
*/
if (document.myForm.sleepingBag.value>0) {
tmpDescription+='{br}'+document.myForm.sleepingBag.value+' Sleeping Bag';
if (document.myForm.sleepingBag.value>1) {
tmpDescription+='s';
}
tmpPrice+=(1*document.myForm.sleepingBag.value*document.myForm.sleepingBagPrice.value);
}
if (document.myForm.foamMatA.value>0) {
tmpDescription+=', '+document.myForm.foamMatA.value+' 1/4" Ground Mat';
if (document.myForm.foamMatA.value>1) {
tmpDescription+='s';
}
tmpPrice+=(1*document.myForm.foamMatA.value*document.myForm.foamMatAPrice.value);
}
if (document.myForm.foamMatB.value>0) {
tmpDescription+=', '+document.myForm.foamMatB.value+' 1/2" Ground Mat';
if (document.myForm.foamMatB.value>1) {
tmpDescription+='s';
}
tmpPrice+=(1*document.myForm.foamMatB.value*document.myForm.foamMatBPrice.value);
}
if (document.myForm.adultCot.value>0) {
tmpDescription+=', '+document.myForm.adultCot.value+' Adult Cot';
if (document.myForm.adultCot.value>1) {
tmpDescription+='s';
}
tmpPrice+=(1*document.myForm.adultCot.value*document.myForm.adultCotPrice.value);
}
if (document.myForm.childCot.value>0) {
tmpDescription+=', '+document.myForm.childCot.value+' Child Cot';
if (document.myForm.childCot.value>1) {
tmpDescription+='s';
}
tmpPrice+=(1*document.myForm.childCot.value*document.myForm.childCotPrice.value);
}
if (document.myForm.blanket.value>0) {
tmpDescription+=', '+document.myForm.blanket.value+' Extra Blanket';
if (document.myForm.blanket.value>1) {
tmpDescription+='s';
}
tmpPrice+=(1*document.myForm.blanket.value*document.myForm.blanketPrice.value);
}
if (document.myForm.tableBurner.checked==1) {
tmpDescription+='{br}Tabletop 2 Burner Stove';
tmpPrice+=(1*document.myForm.tableBurnerPrice.value);
}
if (document.myForm.standingBurner.checked==1) {
tmpDescription+=', Standing 2 Burner Stove';
tmpPrice+=(1*document.myForm.standingBurnerPrice.value);
}
if (document.myForm.table4x4.value>0) {
tmpDescription+=', '+document.myForm.table4x4.value+' 4x4 Table';
if (document.myForm.table4x4.value>1) {
tmpDescription+='s';
}
tmpPrice+=(1*document.myForm.table4x4.value*document.myForm.table4x4Price.value);
}
if (document.myForm.table3x6.value>0) {
tmpDescription+=', '+document.myForm.table3x6.value+' 3x6 Table';
if (document.myForm.table3x6.value>1) {
tmpDescription+='s';
}
tmpPrice+=(1*document.myForm.table3x6.value*document.myForm.table3x6Price.value);
}
if (document.myForm.cookset.checked==1) {
tmpPrice+=(1*document.myForm.cooksetPrice.value);
tmpDescription+=', Cookset';
}
if (document.myForm.coffeeMaker.checked==1) {
tmpDescription+=', Coffee Maker';
tmpPrice+=(1*document.myForm.coffeeMakerPrice.value);
}
if (document.myForm.cookingStation.checked==1) {
tmpDescription+=', Cooking Station';
tmpPrice+=(1*document.myForm.cookingStationPrice.value);
}
if (document.myForm.placeSetting.value>'') {
tmpField=document.myForm.placeSetting.value;
tmpArray = tmpField.split(':');
tmpDescription+=', '+tmpArray[0];
tmpPrice+=(1*tmpArray[1]);
}
if (document.myForm.washBin.checked==1) {
tmpDescription+=', 2 Plastic Wash Bins';
tmpPrice+=(1*document.myForm.washBinPrice.value);
}
if (document.myForm.dishClothes.checked==1) {
tmpDescription+=', Dish Clothes';
tmpPrice+=(1*document.myForm.dishClothesPrice.value);
}
if (document.myForm.castIronSkillet.checked==1) {
tmpDescription+='{br}Cast Iron Skillet (Campfire Cooking)';
tmpPrice+=(1*document.myForm.castIronSkilletPrice.value);
}
if (document.myForm.hotDogStick.value>0) {
tmpDescription+=', '+document.myForm.hotDogStick.value+' Hot Dog Stick';
if (document.myForm.hotDogStick.value>1) {
tmpDescription+='s';
}
tmpPrice+=(1*document.myForm.hotDogStick.value*document.myForm.hotDogStickPrice.value);
}
if (document.myForm.pieMaker.value>0) {
tmpDescription+=', '+document.myForm.pieMaker.value+' Mountain Pie Maker';
if (document.myForm.pieMaker.value>1) {
tmpDescription+='s';
}
tmpPrice+=(1*document.myForm.pieMaker.value*document.myForm.pieMakerPrice.value);
}
if (document.myForm.dutchOven.checked==1) {
tmpDescription+=', Dutch Oven (with Tripod)';
tmpPrice+=(1*document.myForm.dutchOvenPrice.value);
}
if (document.myForm.cookingGrill.checked==1) {
tmpDescription+=', Cooking Grill Grate';
tmpPrice+=(1*document.myForm.cookingGrillPrice.value);
}
if (document.myForm.propaneLantern.value>0) {
tmpDescription+='{br}'+document.myForm.propaneLantern.value+' Propane Lantern';
if (document.myForm.propaneLantern.value>1) {
tmpDescription+='s';
}
tmpPrice+=(1*document.myForm.propaneLantern.value*document.myForm.propaneLanternPrice.value);
}
if (document.myForm.batteryLantern.value>0) {
tmpDescription+=', '+document.myForm.batteryLantern.value+' Battery Lantern';
if (document.myForm.batteryLantern.value>1) {
tmpDescription+='s';
}
tmpPrice+=(1*document.myForm.batteryLantern.value*document.myForm.batteryLanternPrice.value);
}
if (document.myForm.flashLight.value>0) {
tmpDescription+=', '+document.myForm.flashLight.value+' Flash Light';
if (document.myForm.flashLight.value>1) {
tmpDescription+='s';
}
tmpPrice+=(1*document.myForm.flashLight.value*document.myForm.flashLightPrice.value);
}
if (document.myForm.campChair.value>0) {
tmpDescription+=', '+document.myForm.campChair.value+' Camp Chair';
if (document.myForm.campChair.value>1) {
tmpDescription+='s';
}
tmpPrice+=(1*document.myForm.campChair.value*document.myForm.campChairPrice.value);
}
if (document.myForm.campToilet.checked==1) {
tmpDescription+='{br}Camp Toilet';
tmpPrice+=(1*document.myForm.campToiletPrice.value);
}
if (document.myForm.wasteBag.value>0) {
tmpDescription+=', '+document.myForm.wasteBag.value+' Camp Toilet Waste Bag';
if (document.myForm.wasteBag.value>1) {
tmpDescription+='s';
}
tmpPrice+=(1*document.myForm.wasteBag.value*document.myForm.wasteBagPrice.value);
}
if (document.myForm.campShower.checked==1) {
tmpDescription+=', Camp Shower Bag w/Shower Head';
tmpPrice+=(1*document.myForm.campShowerPrice.value);
}
if (document.myForm.showerDeck.checked==1) {
tmpDescription+=', Camp Shower Deck';
tmpPrice+=(1*document.myForm.showerDeckPrice.value);
}
/*
This stores the built up description to the forms product field to be compatible with
Mals cart
*/
document.myForm.product.value=tmpDescription;
/*
This stores the built up price to the forms price field to be compatible with
Mals cart
*/
document.myForm.price.value=(1*tmpPrice*document.myForm.Days.value);
/*
This updates the running total value at the bottom of the form so that the user can see
how much they are spending before sending the data to the form
*/
document.myForm.runningTotal.value=(1*tmpPrice*document.myForm.Days.value).toFixed(2);
}
</script>
</head>
<p>
<input type="hidden" name="return" value="www.buildingsmiles.org/3v3reg2.html">;
<input type="hidden" name="userid" value="xxxxxxxx">
<input type="hidden" name="product">
<input type="hidden" name="price">
<input type="hidden" name="noqty" value="2">
<input type="hidden" name="qty" value="1">
</p>
<form action="http://ww4.aitsafe.com/cf/add.cfm"; id="myForm" name="myForm" onsubmit="return submitForm();">
<p class="style2">Building Smiles 3v3 Fundraising Tournament</p>
<p>Choose Age Level:
<select id="campArea" name="campArea">
<option value="select">Select Age Level</option>
<option value="U6-U10:165.00">U6-10 3v3</option>
<option value="U11-14:175.00">U11-U14 4v4</option>
<option value="Adults:175.00">Adults 4v4</option>
<option value="In-kind Donation:10.00">In-kind Donation</option>
</select>
</p>
<p>Choose Division Level:
<!-- For all drop boxes the onchange code is required to that it forces the running total to be updated -->
<select name="noCampers" onchange="sumFields();">
<option value="">Choose Division</option>
<option value="Recreational">Recreational</option>
<option value="Competitive">Competitive</option>
</select>
</p>
<p>Choose Gender:
<!-- For all drop boxes the onchange code is required to that it forces the running total to be updated -->
<select name="noCampers" onchange="sumFields();">
<option value="">Choose Gender</option>
<option value="Boys">Boys</option>
<option value="Girls">Girls</option>
<option value="Adult Men">Adult Men</option>
<option value="Adult Women">Adult Women</option>
<option value="Adult Coed">Adult Coed</option>
</select>
</p>
<p>Total Players:
<select name="carpetSquares" onchange="sumFields();">
<option value="" selected="selected">Choose Players</option>
<option value="3 players:6.00">3 players - $6.00</option>
<option value="4 players:8.00">4 players - $8.00</option>
<option value="5 players:10.00">5 players - $10.00</option>
<option value="6 players:12.00">6 players - $12.00</option>
<option value="7 players:14.00">7 players - $14.00</option>
<option value="8 players:16.00">8 players - $16.00</option>
</select>
</p>
<p>T-Shirt Package:
<select name="gazebo" onchange="sumFields();">
<option value="" selected="selected">No Thanks!</option>
<option value="3v3 Team:30.00">3v3 Team (6 Shirts) - $30.00</option>
<option value="4v4 Team:40.00">4v4 Team (8 Shirts) - $40.00</option>
<option value="Donation:10.00">In-kind Donation - $10.00</option>
</select>
</p>
<p><input type="submit" value="Register!"> <input type="reset" value="Reset"></p>
</form>
----------------------------
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2014 Invision Power Services, Inc.