Add to Cart buttons do not always work -- why?

joncow
Contributor
Contributor

I have generated 3 Add to cart buttons, two of them over a year ago, the third about 8 months ago. i added them to my web pages using Dreamweaver.  When I click the two older buttons, they go to the PayPal login page. the third (newer) button goes to the shopping cart.

Looking into this, I found a mention that in Dreamweaver you need to uncheck a preference so the button form is not modified.

I generated the two older buttons again, and place them using the unchecked preference in Dreamweaver. 

The two buttons still do not work, the third button still does work.

When I click on the buttons that do not work, it displays the following code in the browser's navigation bar:

https://www.paypal.com/cgi-bin/webscr  --and then the paypal login screen appears.

 

When I click the button that does work, it displays the following code in the broweser's navigation bar:

https://www.paypal.com/cgi-bin/webscr -- which becomes:

https://www.paypal.com/us/cgi-bin/webscr?cmd=_flow&SESSION=W0bzYE ...  --etc --and the shopping cart appears.

 

When I view the source code for the page/button that does work, it looks identical (except for the unique code for the item) to the source code for the buttons that don't work.

 

Any ideas what can be wrong?

Login to Me Too
6 REPLIES 6

PayPal_Frank
Administrator
Administrator

Hi joncow,

 

The issue you describe is usually caused by website creation software modifying the form code so great job on finding that first.  Many times if there are nested form elements there can be issues.

 

One option would be to delete all traces of the PayPal button code from your HTML.  Then repaste the button code to see if that cleared anything up.  If that doesn't work, feel free to post your button code so we can find the problem.

 

- Frank

If you see a helpful post, please accept it as a solution or give the author kudos. 🙂 Thanks!
Login to Me Too

joncow
Contributor
Contributor

Thanks, Frank.

I downloaded TextWrangler (so I wouldn't have to use DreamWeaver).

I stripped out all Add to Cart buttons and View cart buttons, pasted in the code (from My Saved Buttons), and uploaded the pages. The View Cart button was re-generated (I wasn't sure) but the Add to Cart button still goes directly to the PayPal login page rather than the shopping cart page.

 

One thing I should mention, if it makes a difference:  I use tables to align pictures & text, so the button forms are inside table rows.

 

I can paste the code or working & non-working pages. Do you want the buttons only or the whole page?

Login to Me Too

PayPal_Frank
Administrator
Administrator

Hi joncow,

 

The section with the button code should be fine but the full page couldn't hurt.  It's possible the tables could be causing a problem but we'll find out when we look at the code. 🙂

 

- Frank

If you see a helpful post, please accept it as a solution or give the author kudos. 🙂 Thanks!
Login to Me Too

joncow
Contributor
Contributor

Here is the section with the button of the page that doesn't work:

 

<div class="Section1"> <font face="Times New Roman, Times, serif"><br>
  </font> 
  <table width="417" border="0" cellspacing="3" cellpadding="4">
    <tr> 
      <td rowspan="1
	  " width="237" valign="top"><font face="Times New Roman, Times, serif">The 
        Sounds Like Fun! DVD, companion booklet, and over 150 cards.</font></td>
      <td width="155" valign="top"> 
        <p><font face="Times New Roman, Times, serif">$29.99</font><font face="Times New Roman, Times, serif"> 
          US Dollars</font></p>
        <form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
          <input type="hidden" name="cmd2" value="_s-xclick">
          <input type="hidden" name="hosted_button_id" value="8691039">
          <input type="image" src="/btn_cart_LG.gif" border="0" name="submit" width="120" height="26">
          <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1"> 
        </form>
      </td>
    </tr>
  </table>
  <br>
  <font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><font face="Arial, Helvetica, sans-serif" size="6"><o:p></o:p></font></span></font></span></font></span></font> 
  <table width="95%" border="0" cellspacing="4" cellpadding="3">
    <tr> 
      <td><img src="/payoptions.gif" width="196" height="23"></td>
    </tr>
  </table>                       
And this is the section with the button that does work:
<p>The Half 'n' Laff game  comes with a 40-page pad, complete with
  instructions on how to play the game.
<p>&nbsp;
<table width="392" border="0" cellspacing="3" cellpadding="4">
  <tr> 
    <td valign="top" width="230">Half 'n' Laff</td>
    <td><font face="Times New Roman, Times, serif">$5.99</font><font face="Times New Roman, Times, serif"> 
      US Dollars </font> 
      <form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
        <input type="hidden" name="cmd2" value="_s-xclick">
        <input type="hidden" name="hosted_button_id" value="8691164">
        <form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="6RZ3362FBWSKU">
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_cart_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>

        <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1"> 
      </form>
    </td>
  </tr>
</table>
Thanks,
 
 
Login to Me Too

PayPal_Frank
Administrator
Administrator

Hi joncow,

 

Thanks for posting the code.  This is a weird thing that Dreamweaver does sometimes.  When you have multiple forms on a page, it starts adding numbers after the variable names.

 

Each of the buttons should have this:

<input type="hidden" name="cmd" value="_s-xclick">

 

You'll just need to remove the "2" after "cmd" in first section of code.  You'll notice that the second section you posted (with the working buttons) also has a "cmd2" but it still works.  The reason for this is that the <form> elements are nested so the <input> with just "cmd" is being used for both buttons. Basically two "<form target="paypal"..." without a </form> to separate them.  It looks like the second button was placed inside of the other button.

 

I've pasted both blocks of code with corrections below.  When you paste this in dreamweaver, you'll want to make sure that it doesn't change "cmd" to "cmd2" again.

 

Corrected section 1:

 

<div class="Section1"> <font face="Times New Roman, Times, serif"><br>
  </font> 
  <table width="417" border="0" cellspacing="3" cellpadding="4">
    <tr> 
      <td rowspan="1
	  " width="237" valign="top"><font face="Times New Roman, Times, serif">The 
        Sounds Like Fun! DVD, companion booklet, and over 150 cards.</font></td>
      <td width="155" valign="top"> 
        <p><font face="Times New Roman, Times, serif">$29.99</font><font face="Times New Roman, Times, serif"> 
          US Dollars</font></p>
        <form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
          <input type="hidden" name="cmd" value="_s-xclick">
          <input type="hidden" name="hosted_button_id" value="8691039">
          <input type="image" src="/btn_cart_LG.gif" border="0" name="submit" width="120" height="26">
          <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1"> 
        </form>
      </td>
    </tr>
  </table>
  <br>
  <font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><font face="Arial, Helvetica, sans-serif" size="6"><oSmiley Tongue></oSmiley Tongue></font></span></font></span></font></span></font> 
  <table width="95%" border="0" cellspacing="4" cellpadding="3">
    <tr> 
      <td><img src="/payoptions.gif" width="196" height="23"></td>
    </tr>
  </table>                       

Corrected Section 2:

 

<p>The Half 'n' Laff game  comes with a 40-page pad, complete with
  instructions on how to play the game.
<p>&nbsp;
<table width="392" border="0" cellspacing="3" cellpadding="4">
  <tr> 
    <td valign="top" width="230">Half 'n' Laff</td>
    <td><font face="Times New Roman, Times, serif">$5.99</font><font face="Times New Roman, Times, serif"> 
      US Dollars </font> 

        <form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="6RZ3362FBWSKU">
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_cart_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
    </td>
  </tr>
</table>

 

Edit: corrected section 2 again when I realized that was only supposed to be one button.

 

Have a great weekend! 🙂

 

- Frank

If you see a helpful post, please accept it as a solution or give the author kudos. 🙂 Thanks!
Login to Me Too

joncow
Contributor
Contributor

Thanks, Frank. That seems to work.

I am in process of getting another program to use instead of Dreamweaver.

Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.