Important alert: (current site time 7/16/2013 12:03:18 AM EDT)
 

VB icon

Shopping Cart

Email
Submitted on: 4/20/2000 2:37:55 AM
By: martin castaņeda  
Level: Intermediate
User Rating: By 7 Users
Compatibility: VbScript (browser/client side)
Views: 32365
author picture
(About the author)
 
     This is an Internet Shopping Cart which is an Accounting and E-Commerce Application

 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.
				
'**************************************
' Name: Shopping Cart
' Description:This is an Internet Shopping Cart which is an Accounting and E-Commerce Application
' By: martin castaņeda
'
'This code is copyrighted and has' limited warranties.Please see http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=6136&lngWId=4'for details.'**************************************

<HTML>
<CENTER>
<FONT SIZE=5>
Martin's Shopping Cart Sample
</FONT>
</CENTER>
<BR><BR>
<FORM NAME=SHOPPINGCARTFORM METHOD=POST ACTION=http://www6.ewebcity.com/martincastaneda/grocery.asp>
<PRE>
Name : <INPUT NAME=NAME SIZE=30>
Email : <INPUT NAME=EMAIL SIZE=30>
Telephone : <INPUT NAME=TELEPHONE SIZE=30>
Address: <INPUT NAME=ADDRESS SIZE=50>
Item : <SELECT NAME=ITEMX> 
 <OPTION VALUE=Empty>Empty
 <OPTION VALUE=Bread>Bread
 <OPTION VALUE=Pampers>Pampers
 <OPTION VALUE=Milk>Milk 
 <OPTION VALUE=Ice_Cream>Ice_Cream
</SELECT>
Price : <INPUT NAME=PRICE VALUE=0.00>
Quantity : <INPUT NAME=QUANTITY VALUE=1>
Amount: <INPUT NAME=AMOUNT VALUE=0.00>
<INPUT TYPE=BUTTON NAME=ADD VALUE="Add to Cart">
Transaction
<TEXTAREA NAME=TRANSACTION COLS=50 ROWS=20></TEXTAREA>
Total : <INPUT NAME=TOTAL VALUE=0.00> 
<INPUT TYPE=RESET VALUE=Reset><INPUT TYPE=SUBMIT VALUE=Submit>
</PRE>
</FORM>
<SCRIPT LANGUAGE=VBSCRIPT>
<!--
SET ENTRYFORM = DOCUMENT.SHOPPINGCARTFORM
SUB ADD_OnClick
 ENTRYFORM.TRANSACTION.VALUE = ENTRYFORM.TRANSACTION.VALUE + "Item: " + ENTRYFORM.ITEMX.VALUE + VBCRLF
 ENTRYFORM.TRANSACTION.VALUE = ENTRYFORM.TRANSACTION.VALUE + "Price: " + ENTRYFORM.PRICE.VALUE + VBCRLF
 ENTRYFORM.TRANSACTION.VALUE = ENTRYFORM.TRANSACTION.VALUE + "Quantity: " + ENTRYFORM.QUANTITY.VALUE + VBCRLF
 ENTRYFORM.TRANSACTION.VALUE = ENTRYFORM.TRANSACTION.VALUE + "Amount : " + ENTRYFORM.AMOUNT.VALUE + VBCRLF + VBCRLF
 ENTRYFORM.TOTAL.VALUE = FORMATNUMBER(CINT(ENTRYFORM.TOTAL.VALUE) + CINT(ENTRYFORM.AMOUNT.VALUE), 2)
END SUB 
SUB QUANTITY_OnChange
 CALL COMPUTE
END SUB
SUB COMPUTE
 ENTRYFORM.AMOUNT.VALUE = FORMATNUMBER(CINT(ENTRYFORM.PRICE.VALUE) * CINT(ENTRYFORM.QUANTITY.VALUE), 2)
 TOTALAMOUNT = CINT(ENTRYFORM.TOTAL.VALUE) + CINT(ENTRYFORM.QUANTITY.VALUE)
END SUB
SUB ITEMX_OnChange
 IF ENTRYFORM.ITEMX.SELECTEDINDEX = 0 THEN ENTRYFORM.PRICE.VALUE = "0.00"
 IF ENTRYFORM.ITEMX.SELECTEDINDEX = 1 THEN ENTRYFORM.PRICE.VALUE = "10.00"
 IF ENTRYFORM.ITEMX.SELECTEDINDEX = 2 THEN ENTRYFORM.PRICE.VALUE = "20.00"
 IF ENTRYFORM.ITEMX.SELECTEDINDEX = 3 THEN ENTRYFORM.PRICE.VALUE = "30.00"
 IF ENTRYFORM.ITEMX.SELECTEDINDEX = 4 THEN ENTRYFORM.PRICE.VALUE = "40.00"
 ENTRYFORM.QUANTITY.VALUE = "1"
 ENTRYFORM.QUANTITY.VALUE = INPUTBOX("Input Quantity of " + ENTRYFORM.ITEMX.VALUE, "Quantity", ENTRYFORM.QUANTITY.VALUE)
 CALL COMPUTE
END SUB
-->
</SCRIPT>
</HTML>


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments
8/26/2003 11:47:53 PM

Martin,
You might want to change the listing description to something like "This is a form processing example which can be used as part of a shopping cart."

What you have posted is not an e-commerce nor an accounting application.

Thanks for sharing though!
(If this comment was disrespectful, please report it.)

 
5/17/2005 11:12:41 AM

My son his working for a small business and the owner wants me to attempt doing a web page where people can access his wares and actually buy on lone.
Is it possible for a guy like me to be able to help him out and does he need to purchase a program for his site to acdcept this type of service to its customer?

randyguy46@myway.com
(If this comment was disrespectful, please report it.)

 
5/17/2005 11:13:20 AM

My son his working for a small business and the owner wants me to attempt doing a web page where people can access his wares and actually buy on lone.
Is it possible for a guy like me to be able to help him out and does he need to purchase a program for his site to acdcept this type of service to its customer?


(If this comment was disrespectful, please report it.)

 
5/17/2005 11:21:31 AM

CORRECTED MESSAGE FROM PRIOR ENTRY DUE TO SPELLING ERRORS!!!

My son is working for a small business and the owner wants me to attempt to creat a web page where people can access his wares and actually buy on line.
Is it possible for a guy like me to be able to help him out (I have done my own Web Page - Personal) by designing him a Web Page which would include this type of service? or
Does he need to purchase a program for his site to acccept this type of service to its customer?

(If this comment was disrespectful, please report it.)

 
5/17/2005 11:24:41 AM

CORRECTED MESSAGE 2 THIS ONE SHOULD MAKE SENSE. IGNORE PREVIOUS 2 MESSAGES (i AM A SPELL RIGHT FREAK!!!

My son is working for a small business and the owner wants me to attempt to creat a web page where people can access his wares and actually buy on line.
Is it possible for a guy like me to be able to help him out (I have done my own Web Page - Personal) by designing him a Web Page which would include this type of service? or
Does he need to purchase a program for his site to acccept this type of service to its customer?

(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.