PriMoThemes — now s2Member® (official notice)

This is now a very OLD forum system. It's in READ-ONLY mode.
All community interaction now occurs at WP Sharks™. See: new forums @ WP Sharks™

Multiple price options for the PayPal page order button

s2Member Plugin. A Membership plugin for WordPress®.

Multiple price options for the PayPal page order button

Postby bennisb » March 28th, 2011, 11:49 am

Hi

How do I add a multiple price option to the s2Member button code that is shown at the bottom of this page - http://www.pensionforecast.org.uk/what- ... om-attack/

I've taken the code from a button I created in PayPal - here's the code my PayPal account generated.

Code: Select all
<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="7WW4A74PCNSVQ">
<table>
<tr><td><input type="hidden" name="on0" value="How many Trusts would you like created?">How many Trusts would you like created?</td></tr><tr><td><select name="os0">
   <option value="1 Trust">1 Trust £300.00</option>
   <option value="2 Trusts">2 Trusts £600.00</option>
   <option value="3 Trusts">3 Trusts £900.00</option>
   <option value="4 Trusts">4 Trusts £1,200.00</option>
   <option value="5 Trusts or more">5 Trusts or more £1,500.00</option>
</select> </td></tr>
</table>
<input type="hidden" name="currency_code" value="GBP">
<input type="image" src="https://www.paypalobjects.com/WEBSCR-640-20110306-1/en_GB/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.paypalobjects.com/WEBSCR-640-20110306-1/en_GB/i/scr/pixel.gif" width="1" height="1">
</form>


Thanks.

Brian
User avatar
bennisb
Registered User
Registered User
 
Posts: 11
Joined: March 22, 2011

Re: Multiple price options for the PayPal page order button

Postby Cristián Lávaque » March 28th, 2011, 12:52 pm

Hmm... Well, you're using a custom option field for the PayPal button, which isn't meant to change the price, but to specify some detail about the object being purchased.

PayPal wrote:Option fields let your customers specify options (such as size or color) for the items they purchase.


In your form, the price is set at £300 by this line:

Code: Select all
<input name="amount" value="300" type="hidden">


You could try taking out that hidden amount field and changing the <select> name to "amount" and then give the options the value in Pounds with the description they have, and see if that works.

Your dropdown code would be like this:

Code: Select all
<select name="amount">
   <option value="300">1 Trust £300.00</option>
   <option value="600">2 Trusts £600.00</option>
   <option value="900">3 Trusts £900.00</option>
   <option value="1200">4 Trusts £1,200.00</option>
   <option value="1500">5 Trusts or more £1,500.00</option>
</select>


This solution would not update the item number, though, which may not be a problem, I don't know.

Code: Select all
<input name="item_number" value="sp:1245:8760" type="hidden">


Let me know if this helped you. :)
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: Multiple price options for the PayPal page order button

Postby bennisb » March 28th, 2011, 1:19 pm

Hi Cristian

Thanks for your reply. I made the changes I think you suggested, but it either showed £0 or error when I clicked on the button. Here's the full code I've got at present...

Code: Select all
How many Trusts would you like created?

<tr><td><select name="amount">
   <option value="300">1 Trust £300.00</option>
   <option value="600">2 Trusts £600.00</option>
   <option value="900">3 Trusts £900.00</option>
   <option value="1200">4 Trusts £1,200.00</option>
   <option value="1500">5 Trusts or more £1,500.00</option>
</select> </td></tr>

<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="business" value="brian@bennis.net" />
<input type="hidden" name="cmd" value="_xclick" />
<!-- Instant Payment Notification & Return Page Details -->
<input type="hidden" name="notify_url" value="http://www.pensionforecast.org.uk/?s2member_paypal_notify=1" />
<input type="hidden" name="cancel_return" value="http://www.pensionforecast.org.uk/" />
<input type="hidden" name="return" value="http://www.pensionforecast.org.uk/?s2member_paypal_return=1" />
<input type="hidden" name="rm" value="2" />
<!-- Configures All Of The Checkout Fields -->
<input type="hidden" name="no_shipping" value="1" />
<input type="hidden" name="no_note" value="1" />
<input type="hidden" name="custom" value="www.pensionforecast.org.uk" />
<input type="hidden" name="currency_code" value="GBP" />
<input type="hidden" name="page_style" value="paypal" />
<input type="hidden" name="item_name" value="NON-MEMBER: Pension Death Benefits Trust. A trust to protect your pension from attack from a variety of sources." />
<input name="item_number" value="sp:1245:8760" type="hidden" />
<!-- Displays The PayPal® Image Button -->
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif" style="width:auto; height:auto; border:0;" alt="PayPal®" />
</form>


It produces £0 using this code and if I change name="item_number" to name="amount" just before value="sp:1245:8760" above, then the PayPal error is produced. I'm obviously being very stupid.

Brian
User avatar
bennisb
Registered User
Registered User
 
Posts: 11
Joined: March 22, 2011

Re: Multiple price options for the PayPal page order button

Postby Cristián Lávaque » March 28th, 2011, 1:33 pm

Yes, item_number is not amount, don't mix them.

The reason why your amount value is not being sent, is because you put the code outside of the form. Here, try this:

Code: Select all
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
   <input type="hidden" name="business" value="brian@bennis.net" />
   <input type="hidden" name="cmd" value="_xclick" />
   <!-- Instant Payment Notification & Return Page Details -->
   <input type="hidden" name="notify_url" value="http://www.pensionforecast.org.uk/?s2member_paypal_notify=1" />
   <input type="hidden" name="cancel_return" value="http://www.pensionforecast.org.uk/" />
   <input type="hidden" name="return" value="http://www.pensionforecast.org.uk/?s2member_paypal_return=1" />
   <input type="hidden" name="rm" value="2" />
   <!-- Configures All Of The Checkout Fields -->
   <input type="hidden" name="no_shipping" value="1" />
   <input type="hidden" name="no_note" value="1" />
   <input type="hidden" name="custom" value="www.pensionforecast.org.uk" />
   <input type="hidden" name="currency_code" value="GBP" />
   <input type="hidden" name="page_style" value="paypal" />
   <input type="hidden" name="item_name" value="NON-MEMBER: Pension Death Benefits Trust. A trust to protect your pension from attack from a variety of sources." />
   <input name="item_number" value="sp:1245:8760" type="hidden" />
   <p>How many Trusts would you like created?</p>
   <select name="amount">
      <option value="300">1 Trust £300.00</option>
      <option value="600">2 Trusts £600.00</option>
      <option value="900">3 Trusts £900.00</option>
      <option value="1200">4 Trusts £1,200.00</option>
      <option value="1500">5 Trusts or more £1,500.00</option>
   </select>
   <!-- Displays The PayPal® Image Button -->
   <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif" style="width:auto; height:auto; border:0;" alt="PayPal®" />
</form>


Hope that helps. :)

By the way, I fixed your posts already, but read this on how to post code in the forums ;) viewtopic.php?f=36&t=2780
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: Multiple price options for the PayPal page order button

Postby bennisb » March 28th, 2011, 3:54 pm

Hi Cristian

Thanks, that's done the trick. But there's one tiny element that could be misleading. You'll see on the PayPal order form it shows Quantity: 1
Image.
That could be misleading if a person has ordered 4 trusts for £1,200. Any ideas?

Brian
User avatar
bennisb
Registered User
Registered User
 
Posts: 11
Joined: March 22, 2011

Re: Multiple price options for the PayPal page order button

Postby Cristián Lávaque » March 28th, 2011, 6:40 pm

I see your problem. Then you could set the amount to 300 and use the dropdown to select a quantity.

Code: Select all
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
   <input type="hidden" name="business" value="brian@bennis.net" />
   <input type="hidden" name="cmd" value="_xclick" />
   <!-- Instant Payment Notification & Return Page Details -->
   <input type="hidden" name="notify_url" value="http://www.pensionforecast.org.uk/?s2member_paypal_notify=1" />
   <input type="hidden" name="cancel_return" value="http://www.pensionforecast.org.uk/" />
   <input type="hidden" name="return" value="http://www.pensionforecast.org.uk/?s2member_paypal_return=1" />
   <input type="hidden" name="rm" value="2" />
   <!-- Configures All Of The Checkout Fields -->
   <input type="hidden" name="no_shipping" value="1" />
   <input type="hidden" name="no_note" value="1" />
   <input type="hidden" name="custom" value="www.pensionforecast.org.uk" />
   <input type="hidden" name="currency_code" value="GBP" />
   <input type="hidden" name="page_style" value="paypal" />
   <input type="hidden" name="item_name" value="NON-MEMBER: Pension Death Benefits Trust. A trust to protect your pension from attack from a variety of sources." />
   <input name="item_number" value="sp:1245:8760" type="hidden" />
   <input name="amount" value="300" type="hidden" />
   <p>How many Trusts would you like created?</p>
   <select name="quantity">
      <option value="1">1 Trust £300</option>
      <option value="2">2 Trusts £600</option>
      <option value="3">3 Trusts £900</option>
      <option value="4">4 Trusts £1,200</option>
      <option value="5">5 Trusts or more £1,500</option>
   </select>
   <!-- Displays The PayPal® Image Button -->
   <input type="image" src="https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif" style="width:auto; height:auto; border:0;" alt="PayPal®" />
</form>


Let me know if that solves it. :)
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: Multiple price options for the PayPal page order button

Postby bennisb » March 29th, 2011, 3:12 am

Hi Cristián

That's brilliant. It works a treat. Thank you so much for your help. I'm sorted now.

Brian
User avatar
bennisb
Registered User
Registered User
 
Posts: 11
Joined: March 22, 2011

Re: Multiple price options for the PayPal page order button

Postby Cristián Lávaque » March 29th, 2011, 8:43 am

Awesome. :)
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010


Return to s2Member Plugin

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 2 guests

cron