• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 637
  • Last Modified:

shopping cart CGI call

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
mmoline
Asked:
mmoline
  • 3
1 Solution
 
maneshrCommented:
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
 
maneshrCommented:
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
 
mmolineAuthor Commented:
Thank you Manesh....I know it was a simple one, I promise to challenge you more in the future!!
0
 
maneshrCommented:
Glad to have helped you.

looking forward to more challenging ones :-)

Rgds
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now