Solved

shopping cart CGI call

Posted on 2000-03-11
4
598 Views
Last Modified: 2013-12-25
I am working on a shopping cart app for a clothing company.  I need to let customers indicate size and color of the product they choose.  The products all have SKU's assigned, and I have the CGI call to add the item to the cart.  My question is this:  I was going to use a pull down menu with the size and color choices presented.  I tried using a standard javascript pull down that looked like this:

<form name="formname">
              <select name="selectName" size="1">
                <option value=""> --Select size/color--</option>
                <option value="http://www.myshop.com/olshop/cart.cgi?add=052SW">Small/white</option>

However, this did not work.  It would pull up another window, which I really don't want it to do, and it did not add the item to the cart.    Basically, that is the CGI call above.  I need to add some type of selection system to the pages to let the customer choose size and color.  The built in stuff on this particular shopping cart is not acceptable for the end result I am trying to achieve, but I have to use this cart.  I can do it with images using the following:

<a HREF="http://www.myshop.com/olshop/cart.cgi?add=052SW"><img src="anyimage.gif" width="18" height="20" border="0"></a>

This works just fine, although since it is an HREF, it redirects you to the "view cart" page.  I would like to avoid the redirect, and simply post the selection to the "cart" 'behind the scenes' so to speak without redirecting the shopper.  

The relevant calls are below:

"To use the shopping cart and ordering features of the online shop you don't have to use the default pages - product list, categories and product search. You can directly use some of the CGI's:

/olshop/product.cgi?id=xxxx - this link will display the product with ID xxxx.

/olshop/cart.cgi?add=xxxx - this link will add the product with ID xxxx to the
     shopping cart, and will display the shopping cart contents.

/olshop/cart.cgi - this link will display the shopping cart contents.

/olshop/orderinfo.cgi - this link will proceed to the ordering form.

For example, if you want customers to add the product 1234 to their shopping cart by clicking on the product picture somewhere on your web site you can use the following HTML code:

     <A HREF="/olshop/cart.cgi?add=1234"><IMG SRC="product.gif"><A>

I don't profess to know what the heck I am doing with this type of setup, so any help/ other suggestions would be appreciated, thank you in advance!!!
0
Comment
Question by:mmoline
  • 3
4 Comments
 
LVL 16

Accepted Solution

by:
maneshr earned 750 total points
ID: 2608131
you can use javascript code to achieve what you want.

"....I was going to use a pull down menu with the size and color choices presented......"

this is totally fine. But what i dont understand is why you dont want to submit the form using CGI, either as a POST method or via GET method??

using CGI with any of the above methods you can easily get what you want!!

Eg.

<form method=GET action="/cgi-bin/my_script.cgi">

<select name="add" size="1">
  <option value=""> --Select size/color--</option>
  <option value="052SW">Small/white</option>
  <option value="060XB">XL/black</option>
</select>

<input type=img src="some_image.gif">
</form>

Now if the user were to click on the image your request would be sent to the CGI script.

However if you dont want a CGI script to be invoked for each and every user action, you might want to consider using cookies with javascript.

i have some websites that offer FREE PERL code for shopping carts. (PERL since i develop using it :) )

they will give you a very good working example, WITH the source code!!

http://www.arpanet.com/perlshop/
http://www.freeperlcode.com/guide/jump.cgi?ID=286
http://www.lecart.com/download.xsp
http://www.freeperlcode.com/guide/jump.cgi?ID=90
http://www.freeperlcode.com/guide/jump.cgi?ID=590
0
 
LVL 16

Expert Comment

by:maneshr
ID: 2608132
you can use javascript code to achieve what you want.

"....I was going to use a pull down menu with the size and color choices presented......"

this is totally fine. But what i dont understand is why you dont want to submit the form using CGI, either as a POST method or via GET method??

using CGI with any of the above methods you can easily get what you want!!

Eg.

<form method=GET action="/cgi-bin/my_script.cgi">

<select name="add" size="1">
  <option value=""> --Select size/color--</option>
  <option value="052SW">Small/white</option>
  <option value="060XB">XL/black</option>
</select>

<input type=img src="some_image.gif">
</form>

Now if the user were to click on the image your request would be sent to the CGI script.

However if you dont want a CGI script to be invoked for each and every user action, you might want to consider using cookies with javascript.

i have some websites that offer FREE PERL code for shopping carts. (PERL since i develop using it :) )

they will give you a very good working example, WITH the source code!!

http://www.arpanet.com/perlshop/
http://www.freeperlcode.com/guide/jump.cgi?ID=286
http://www.lecart.com/download.xsp
http://www.freeperlcode.com/guide/jump.cgi?ID=90
http://www.freeperlcode.com/guide/jump.cgi?ID=590
0
 

Author Comment

by:mmoline
ID: 2612651
Thank you Manesh....I know it was a simple one, I promise to challenge you more in the future!!
0
 
LVL 16

Expert Comment

by:maneshr
ID: 2612685
Glad to have helped you.

looking forward to more challenging ones :-)

Rgds
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
How important is it to take extra precautions to protect your online business? These are some steps you can take to make sure you're free of any cyber crime.
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question