?
Solved

add to script below

Posted on 2005-03-19
6
Medium Priority
?
283 Views
Last Modified: 2010-04-06
I have the following script on my site for e commerce purposes.  If it would help you to see it you can goto www.heavenscentwaxcreations.com/store.htm

What I need is to add a space on there that will give the person the option to type in a certificate number.  Right now all I have are drop down menus with pretyped text in them.  

Here is the code below:

<head>
<script language="JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//-->
</script>
</head>
<head>
<script type="text/javascript">

function Dollar (val) {  
var str,pos,rnd=0;
  if (val < .995) rnd = 1;  
  str = escape (val*1.0 + 0.005001 + rnd);  
  pos = str.indexOf (".");
  if (pos > 0) str = str.substring (rnd, pos + 3);
  return str;
}

function ReadForm (obj1) {
var i,amt,des,obj,pos,val;
  amt = obj1.baseamt.value*1.0;      
  des = obj1.basedes.value;          
  for (i=0; i<obj1.length; i++) {    
    obj = obj1.elements[i];          
    if (obj.type == "select-one" && 
        obj.name == "") {            
      pos = obj.selectedIndex;        
      val = obj.options[pos].value;  
      pos  = val.indexOf ("@");      
      if (pos > 0) amt = val.substring (pos + 1)*1.0;
      pos  = val.indexOf ("+");      
      if (pos > 0) amt = amt + val.substring (pos + 1)*1.0;
      pos  = val.indexOf ("%");      
      if (pos > 0) amt = amt + (amt * val.substring (pos + 1)/100.0);
      if (des.length == 0) des = val;
      else des = des + ", " + val;    
    }
  }
  obj1.item_name.value = des;
  obj1.amount.value = Dollar (amt);
  if (obj1.tot) obj1.tot.value = "$" + Dollar (amt);
}

</script>
</head>



<body>
  <form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
                                <p>
                                  <input type="hidden" name="cmd" value="_cart">
                                    <input type="hidden" name="business" value="sheila@heavenscentwaxcreations.com">
                                    <input type="hidden" name="item_name" value="">
                                    <input type="hidden" name="amount" value="">
                                    <input type="hidden" name="return" value="http://www.heavenscentwaxcreations.com/thanks.htm">
                                    <input type="hidden" name="no_note" value="1">
                                    <input type="hidden" name="currency_code" value="USD">
                                    <input type="hidden" name="lc" value="US">
                                    <input type="hidden" name="add" value="1">
                                    <input type="hidden" name="baseamt" value="0.00" />
                                    <input type="hidden" name="basedes" value="Boy Pajama Pals" />
                                    <br />
                                    &nbsp; &nbsp;
                                    <select onchange = "ReadForm (this.form);">
                                      <option value="">Select Scent</option>
                                                               
                                     
<option value="Apple Cinnamon +13.50">Apple Cinnamon</option>
<option value="Baby Powder +13.50">Baby Powder</option>

                                   
                                    </select>
                                    <br />
                                    <br />
                                    Quantity
                                    <input type="text" name="quantity" size="3" value="1" />
                                  </p>
                                 
                                <p>Each&gt;
                                  <input type="text" name="tot" size="8" value="$0.00" />
                                  </p>
                                  <p>
                                    <input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but22.gif"
border="0" name="submit3" alt="Make payments with PayPal - it's fast, free and secure!">
                                  </p>
                             
                              </form>


                        <form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
                                <div align="center"> </div>
                        </form>
                                                
                              </td>
                          </tr><tr>
                            <td width="182" valign="top" align="center" height="474">
                              <TABLE cellpadding="0" cellspacing="0" border="1" bordercolor="#003300" style="border-collapse: collapse" width="164" height="260">
                                <tr>
                                  <td height="283">
                                    <div align="center">
                                      <p><img src="picts/Girl%20Pajama%20Pals%207%5B1%5D%5B1%5D.5%20inches%20sitting.jpg" width="132" height="180"></p>
                                      <p>Girl Pajama Pals 7.5 inches sitting.
                                        Comes in color shown.</p>
                                    </div>
                                  </td></tr></table>
</body>
0
Comment
Question by:brycol24
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 32

Expert Comment

by:Batalf
ID: 13582903
You just need a new text field?

<head>
<script language="JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>
</head>
<head>
<script type="text/javascript">

function Dollar (val) {  
var str,pos,rnd=0;
if (val < .995) rnd = 1;  
str = escape (val*1.0 + 0.005001 + rnd);  
pos = str.indexOf (".");
if (pos > 0) str = str.substring (rnd, pos + 3);
return str;
}

function ReadForm (obj1) {
var i,amt,des,obj,pos,val;
amt = obj1.baseamt.value*1.0;      
des = obj1.basedes.value;          
for (i=0; i<obj1.length; i++) {    
obj = obj1.elements[i];          
if (obj.type == "select-one" && 
obj.name == "") {            
pos = obj.selectedIndex;        
val = obj.options[pos].value;  
pos  = val.indexOf ("@");      
if (pos > 0) amt = val.substring (pos + 1)*1.0;
pos  = val.indexOf ("+");      
if (pos > 0) amt = amt + val.substring (pos + 1)*1.0;
pos  = val.indexOf ("%");      
if (pos > 0) amt = amt + (amt * val.substring (pos + 1)/100.0);
if (des.length == 0) des = val;
else des = des + ", " + val;    
}
}
obj1.item_name.value = des;
obj1.amount.value = Dollar (amt);
if (obj1.tot) obj1.tot.value = "$" + Dollar (amt);
}

</script>
</head>



<body>
<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<p>
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="sheila@heavenscentwaxcreations.com">
<input type="hidden" name="item_name" value="">
<input type="hidden" name="amount" value="">
<input type="hidden" name="return" value="http://www.heavenscentwaxcreations.com/thanks.htm">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="add" value="1">
<input type="hidden" name="baseamt" value="0.00" />
<input type="hidden" name="basedes" value="Boy Pajama Pals" />
<br>
<table border="0">
<tr><td colspan="2">
<select onchange = "ReadForm (this.form);">
<option value="">Select Scent</option>
<option value="Apple Cinnamon +13.50">Apple Cinnamon</option>
<option value="Baby Powder +13.50">Baby Powder</option>
</select>
</td><tr>
<td>Quantity </td>
<td><input type="text" name="quantity" size="3" value="1" /></td>
</tr>
<tr>
<td><p>Each&gt; </td>
<td><input type="text" name="tot" size="8" value="$0.00" /></TD></TR>
<TR>
<TD><p>Certificate </TD>
<TD><input type="text" name="certificateNo" size="20" value="" /></TD>
</TR>
</TABLE>
<p>
<input type="image" src="http://www.heavenscentwaxcreations.com/https://www.paypal.com/en_US/i/btn/x-click-but22.gif"
border="0" name="submit3" alt="Make payments with PayPal - it's fast, free and secure!">
</p>

</form>


<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<div align="center"> </div>
</form>

</td>
</tr><tr>
<td width="182" valign="top" align="center" height="474">
<TABLE cellpadding="0" cellspacing="0" border="1" bordercolor="#003300" style="border-collapse: collapse" width="164" height="260">
<tr>
<td height="283">
<div align="center">
<p><img src="http://www.heavenscentwaxcreations.com/picts/Girl%20Pajama%20Pals%207%5B1%5D%5B1%5D.5%20inches%20sitting.jpg" width="132" height="180"></p>
<p>Girl Pajama Pals 7.5 inches sitting.
Comes in color shown.</p>
</div>
</td></tr></table>
</body>
0
 

Author Comment

by:brycol24
ID: 13583586
I tried that and it will not read it.  Everything showes up on the pay pal shopping cart but that....Does something have to be done in the script at the top?
0
 
LVL 32

Expert Comment

by:Batalf
ID: 13583607
Does the paypal documentation specify anything regarding the name of such form fields?

The form field is posted, but the name "certificateNo" doesn't meet the requirements from paypal.
0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 

Author Comment

by:brycol24
ID: 13583619
So does that mean I'm out of luck or can it still be done...If it can be done then can you help with it?  Thanks a million.

Brian
0
 

Author Comment

by:brycol24
ID: 13583630
all the script above or most of it above is not paypals that i am aware of.  

just thought that might have some effect on this.

bry
0
 
LVL 32

Accepted Solution

by:
Batalf earned 2000 total points
ID: 13583649
Maybe you could rename the field to "custom".

i.e. change

<input type="text" name="certificateNo" size="20" value="" />

to

<input type="text" name="custom" size="20" value="" />

Check the documentation here:
http://www.paypal.com/cgi-bin/webscr?cmd=_pdn_howto_checkout_outside
0

Featured Post

Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

Question has a verified solution.

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

Preface In the first article: A Better Website Login System (http://www.experts-exchange.com/A_2902.html) I introduced the EE Collaborative Login System and its intended purpose. In this article I will discuss some of the design consideratio…
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

765 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