I could use a little help

This is a discussion on "I could use a little help" within the JavaScript Forum section. This forum, and the thread "I could use a little help are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Sep 4th, 2006, 01:12
New Member
Join Date: Sep 2006
Location: Kentucky
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
I could use a little help

I am building an ecommerce website I currently have a drop down box for the user to select a color. I need some script to integrate this into a paypal shopping cart. I other words when they select there color it does nothing I want it to go to the shopping cart an tell me what color they ordered. Any help would be great
Reply With Quote

  #2 (permalink)  
Old Sep 4th, 2006, 17:00
Most Reputable Member
Join Date: Apr 2006
Location: Cornwall, UK
Posts: 1,310
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Skype™ to ukgeoff
Re: I could use a little help

Difficult to respond without seeing the page and the code you are using.
Reply With Quote
  #3 (permalink)  
Old Sep 4th, 2006, 18:21
New Member
Join Date: Sep 2006
Location: Kentucky
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Re: I could use a little help

here is the code for the drop down box

<form name="color"><div align="left">
<select name="select1" size="1">
<option>Black</option>
<option>Bronze</option>
<option>Green</option>
<option>Pewter</option>
</select></div></form>

Here is the code for the add to cart button. what i am looking to have happen is when they select there color and click add to cart it carries the color trough to the shopping cart page

<Form method="post" action="https://www.paypal.com/cgi-bin/webscr" target="paypal">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="brett@gardendiscounters.com">
<input type="hidden" name="item_name" value="Round 360 Chiminea">
<input type="hidden" name="item_number" value="00312">
<input type="hidden" name="amount" value="184.99">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="shipping" value="">
<input type="hidden" name="shipping2" value="">
<input type="hidden" name="handling_cart" value="">
<input type="hidden" name="bn" value="ButtonFactory.Tripod.001">
<input type="image" name="add" src="https://www.paypal.com/images/x-click-but22.gif">
</form>
Reply With Quote
  #4 (permalink)  
Old Sep 4th, 2006, 20:10
spinal007's Avatar
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 22
Posts: 1,620
Blog Entries: 1
Thanks: 0
Thanked 2 Times in 2 Posts
Send a message via ICQ to spinal007 Send a message via MSN to spinal007 Send a message via Yahoo to spinal007 Send a message via Skype™ to spinal007
Re: I could use a little help

Can you use a server-side language such as ASP or PHP?
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
Reply With Quote
  #5 (permalink)  
Old Sep 5th, 2006, 15:54
New Member
Join Date: Sep 2006
Location: Kentucky
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Re: I could use a little help

Sorry my host will only let me use HTML or Java Script
Reply With Quote
  #6 (permalink)  
Old Sep 5th, 2006, 17:16
spinal007's Avatar
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 22
Posts: 1,620
Blog Entries: 1
Thanks: 0
Thanked 2 Times in 2 Posts
Send a message via ICQ to spinal007 Send a message via MSN to spinal007 Send a message via Yahoo to spinal007 Send a message via Skype™ to spinal007
Re: I could use a little help

Code: Select all
 <script language="Javascript" type="text/javascript">
function PassColourToPaypal(f){
 f.elements['item_name'].value += ' ('+ f.elements['colour'].value + ')';
}
</script>
<Form method="post" action="https://www.paypal.com/cgi-bin/webscr" target="paypal" onsubmit="PassColourToPaypal(this);">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="brett@gardendiscounters.com">
<input type="hidden" name="item_name" value="Round 360 Chiminea">
<input type="hidden" name="item_number" value="00312">
<input type="hidden" name="amount" value="184.99">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="shipping" value="">
<input type="hidden" name="shipping2" value="">
<input type="hidden" name="handling_cart" value="">
<input type="hidden" name="bn" value="ButtonFactory.Tripod.001">
<input type="image" name="add" src="https://www.paypal.com/images/x-click-but22.gif">
<select name="colour" id="colour" size="1">
<option>Black</option>
<option>Bronze</option>
<option>Green</option>
<option>Pewter</option>
</select>
</form>
Or the quickest way is to add this to the form above...
Code: Select all
onsubmit="this.elements['item_name'].value += ' ('+ this.elements['colour'].value + ')';"
... then you don't need the seperate script tag.

Some brownies would be nice
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)

Last edited by spinal007; Sep 5th, 2006 at 17:18.
Reply With Quote
  #7 (permalink)  
Old Sep 5th, 2006, 19:48
Ryan Fait's Avatar
SuperMember

SuperMember
Join Date: May 2006
Location: Las Vegas
Posts: 3,786
Thanks: 0
Thanked 0 Times in 0 Posts
Re: I could use a little help

Would it be easier to use a different item number for each color?
Reply With Quote
  #8 (permalink)  
Old Sep 6th, 2006, 09:59
spinal007's Avatar
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 22
Posts: 1,620
Blog Entries: 1
Thanks: 0
Thanked 2 Times in 2 Posts
Send a message via ICQ to spinal007 Send a message via MSN to spinal007 Send a message via Yahoo to spinal007 Send a message via Skype™ to spinal007
Re: I could use a little help

course, but without any server-side coding, it's not ideal to duplicate every other field in the form 6+ times...
and it would be a pain to change prices, etc...

I think it's a better "long term" solution
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
Reply With Quote
  #9 (permalink)  
Old Sep 6th, 2006, 13:41
New Member
Join Date: Sep 2006
Location: Kentucky
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Re: I could use a little help

I tried this code several different was and still nothing What have I done wrong?
Reply With Quote
  #10 (permalink)  
Old Sep 7th, 2006, 14:18
spinal007's Avatar
Moderator
Join Date: Mar 2004
Location: Good Ol'London
Age: 22
Posts: 1,620
Blog Entries: 1
Thanks: 0
Thanked 2 Times in 2 Posts
Send a message via ICQ to spinal007 Send a message via MSN to spinal007 Send a message via Yahoo to spinal007 Send a message via Skype™ to spinal007
Re: I could use a little help

I don't know what you've done wrong because I can't see what you've done...
Last Blog Entry: Random String in Javascript (Apr 21st, 2008)
Reply With Quote
Reply

Tags
could, use, little, help

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 04:44.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43