Enable/disable Paypal Button via Checkbox | need some coding help

Hello.

I have my Paypal-Standard checkout button and it works perfect. But I have to place an extra checkbox for my clients before it, to do an extra accept of Terms and Conditions, cause the law of my country wants it so. Don`t think about it - the brain of bureaucrats is a black hole.

I found this nice piece of code:


https://pastebin.com/jKfvDqFF

(code is viewable under pastebin.com, cause it`s not allowed to place it in here)

That gives my a checkbox and a standard submit button, that is only enable, if the checkbox is checked.

How can I replace the standard submit button with the S2member Paypal-Button Shortcode?

Thanks a lot.
Robert

I don’t know what code you’re using, and I certainly won’t be clicking on that link. You can easily post code on this forum if you enclose it within backticks.

All you need to do is add a Terms and Conditions field and a checkbox to the s2Member registration form. See Custom Registration/Profile Fields.

Hello Tim,

sorry but thats not exactly what I need. I know the Custom Registration Fields and I have two in my Login Page - for Terms and Condition and also one for Disclaimer. What I need is an extra checkbox to activate the Paypal Button. As I has described, I have to place this box, cause the law in our country want that.

Background of the story: The client has to give is active agreement that he lost his right of withdrawal, if he buys “digital content” online and want the shipping of the download direct after the payment.

So for my needs the build in Custom Registration Field - options can`t do this job. That button would be on the wrong place of my site.

So here is the code again, hope it will be displayed, otherwise, I will place a screenshot:

I tried to exchange the “Submit-Element” with my S2-Paypal-Button [via shortcode from the generator], but no success. My paypal button has the css-id: ppbutton.

Thanks at all.

Tricky problem… Not easy, but possible to do. But difficult to explasn, sorry. If you need a developer, please contact me.

Hello Mr. Cheshmedjiev,

Ohh yeahh, it is really tricky. And thank you very much for your offering. I will give a friend of my a try. He`s back from holiday today and have more knowledge in html and php as I have.

But if he fail, I would come back to you.

@ all, feel free to post a solution.

Thanks a lot
Robert

By the way have another problem or more an suggestion for S2member. It would be very nice If I could post the EOT time into the modifikation email, which his sent. So my client have an document, where he can see is time for access.

I am wondering, I can handel the [S2EOT /] at page. And there is a variable for EOT in the reminder emails, but it doesn`t work with the modifikation email.

Reminder-Email: Great tool in S2member Pro and it`s great that an admin can exclude or include some users as he want. But, if you build this extra option, why can have a user not the chance to select or deselect, if he wants a reminder of EOT?

I love S2member very much and use it since 2013. But it has many little tricky things in it, there I thought for myself, why it isn`t well thought out to the end? Like this with the checkbox for a button?

We have the function for custiom fields, but why only for the registration?
We can modify the Auto Return Page, but why only the header?
We have a Reminder Emails and EOT Setup, but no EOT Option in Modifikation Emails?

Yes everything is open and you can code what you need, but not every customer is a coder.

Ok, well.

Have a nice weekend.

Hi Bob,

First of all, you must know, that I am not a core developer of s2M, only a user, and a freelancer developer.

As you say, “everything is open” in s2M, which is the key feature, as you can code anything (so I build several extensions to it). That’s because it is so flexible. And so terrible, when you first see it :slight_smile:

For EOT in emails: try [s2Get … /] shortcode, or PHP variant

echo do_shortcode(’[s2Get … /]’);

Look at “s2Member -> API / Scripting -> s2Member PHP/API Constants”.

Hello Mr. Cheshmedjiev,

I solved my PayPal Button problem. Did a self learning Java Script crash-workshop and ended up with this solution:

Part 1 - Code for my checkbox:

And here is part 2 for my PayPal button:

Sorry for the pictures, but backticks won`t work.

Thats my final solution. At first I tried a script that works with the complete open form-code of the S2M Button. Thats works too, but then the button data will not get encrypted and my PayPal-Account denied the transaction. Thats right for security reasons.

So I do it by a display switch between a blank button picture and the real button-code.

Maybe someone can give me a line, for this version, that my checkbox is cleared, if a user returns to the page. A kind of an onload function or something like that.

Thank you.

Congratulation about the solution! If it works, it’s good.

And thanks that you share it!

Your checkbox should be unchecked at each load of the page, since it is not set to be checked in your “Part 1” code.

If the page load the first time, my checkbox is unchecked - that`s right.

But in the case, a user checked the box and click to paypal and stops his shopping for any reason and go return, my selling page load again, but the checkbox stays checked and as paypal button the button-picture is load again.

Its not really a problem, but it isnt really beautiful.

I tried different things with onload=resetBox(); But no success, I ended always up with a broken functionality of my working code.

Can’t suggest a solution - can not understand your code. Strange for a programmer, yeah… Maybe it is not full. But if works for you, that’s OK.