Solved

shopping cart CGI call

Posted on 2000-03-11
4
591 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

It is a general practice to get rid of old user profiles on a computer  in a LAN environment. As I have been working with a company in a LAN environment where users move from one place to some other place at times. This will make many user profil…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

706 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now