Page 1 of 1

html button

PostPosted: May 27th, 2011, 9:52 am
by leonellfp
Hi,

Can I use the paypal Resulting PayPal® Button Code in an html page outside wordpress ?

Many thanks!

Re: html button

PostPosted: May 28th, 2011, 12:56 am
by Cristián Lávaque
The full code, yes; not the shortcode, though, that's WordPress'.

Re: html button

PostPosted: May 28th, 2011, 4:12 am
by leonellfp
Hi Cristián,

I paste the full code, but when I click the button the paypal page shows some php code... :roll:

Please see the bellow image:
Image

Many thanks

Re: html button

PostPosted: May 28th, 2011, 12:25 pm
by Cristián Lávaque
I see. The full code has those two bits of PHP in it and you need to use the Exec PHP plugin for them to work, and not use the the visual editor or it causes what you get.

You can use shortcode for them instead of PHP, try replacing those with these, as long as you use them in the WordPress installation you have s2member in:

Code: Select all
[s2Get constant="S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0" /]
[s2Get constant="S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0" /]


Hmm... re-reading your first post, though, you're probably using the button in another website, right?

Re: html button

PostPosted: May 28th, 2011, 12:51 pm
by leonellfp
Yes, the customer would like to have also a button on a html landing page outside wordpress...
Is this still possible ?

Re: html button

PostPosted: May 28th, 2011, 3:12 pm
by Cristián Lávaque
Maybe... If you're going to use those buttons to register new members only, then you can leave their values empty, in which case you will be able to use the buttons outside WordPress.

You can read the documentation for those fields at the bottom of WP Admin -> s2Member -> API / Scripting -> s2Member PHP/API Constants.

S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0 ... This auto-fills the on0 value in PayPal® Button Codes. If a Button Code is presented to a logged-in Member, this will auto-fill the value for the on0 input variable, with the string: "Referencing Customer ID". Otherwise, it will be an empty string.

S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0 ... This auto-fills the os0 value in PayPal® Button Codes. If a Button Code is presented to a logged-in Member, this will auto-fill the value for the os0 input variable, with the value of S2MEMBER_CURRENT_USER_SUBSCR_OR_WP_ID. Otherwise, it will be an empty string.

These two Constants are special. They are used by the PayPal® Button Generator for s2Member. This is how s2Member identifies an existing Member ( and/or a Free Subscriber ), who is already logged in when they click a PayPal® Modification Button that was generated for you by s2Member. Instead of forcing a Member ( and/or a Free Subscriber ) to re-register for a new account, s2Member can identify their existing account, and update it, according to the modified terms in your Button Code. These three Button Code parameters: on0, os0, modify, work together in harmony. If you're using the Shortcode Format for PayPal® Buttons, you won't even see these, because they're added internally by the Shortcode processor. Anyway, they're just documented here for clarity; you probably won't use these directly; the Button Generator pops them in.


I hope that helps.

Re: html button

PostPosted: May 28th, 2011, 3:38 pm
by leonellfp
Yes that button will be on that landing page, and it's only for new members.
So if I understand correctly I can use the full code removing the 2 php lines ?

Code: Select all
[s2Get constant="S2MEMBER_CURRENT_USER_VALUE_FOR_PP_ON0" /]
[s2Get constant="S2MEMBER_CURRENT_USER_VALUE_FOR_PP_OS0" /]


Or do I have to put anything else ?

Many Thanks

Re: html button

PostPosted: May 28th, 2011, 4:53 pm
by Cristián Lávaque
You can remove the parts between <?php and ?>, so values will be empty for those fields value="".

Re: html button

PostPosted: May 28th, 2011, 5:35 pm
by leonellfp
Ok,

That solve the html button issue...
How can I change the button full code to open the paypal page on a new window ?
(target="_blank")

Many thanks!

Re: html button

PostPosted: May 28th, 2011, 5:43 pm
by leonellfp
I think I find it myself...

On the first line of the code, I change this:
Code: Select all
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" >


to this
Code: Select all
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">


Am I right...?

Thanks

Re: html button

PostPosted: May 28th, 2011, 6:06 pm
by Cristián Lávaque
Yep, that's the way. :)

Re: html button

PostPosted: May 28th, 2011, 6:24 pm
by leonellfp
Thank you Cristián, Great Support... !!!

Re: html button

PostPosted: May 28th, 2011, 6:32 pm
by Cristián Lávaque
You're welcome. I'm glad I could help you with that! :)