emilianoph
Forum Replies Created
-
Well, the key is to inspect the codes in github:
Inside this code is the basic idea to read the gateway value checked in the radio buttons of the checkout page:https://github.com/strangerstudios/pmpro-add-paypal-express/blob/dev/pmpro-add-paypal-express.php
Specifically:
<script type=”text/javascript”>
jQuery(document).ready(function() {//move paypal express button into submit box
//detect gateway change
jQuery(‘input[name=gateway]’).click(function() {
var chosen_gateway = jQuery(this).val();
if(chosen_gateway == ‘paypalexpress’) {
// DO FUNCTION 1
} else if(chosen_gateway == ‘check’) {
// DO FUNCTION 2
} else {
// DO FUNCTION 3
}
});
…</script>
I tested and it works. I will prepare a basic code and I will publish it just in case someone need it.
From my point of view, it should be documented ( I have the PRO version of PaidMembership)
I have these two add ons installed:
PayPal Express Add On and Pay by Check Add On, so although in the settings of PMPro I have the ‘Stripe’ gateway selected, three options are shown in the checkout page:
Card, Paypal and Check, as I want.After reading a posts where from PmPro the gave this example:
How to add a fee depending on the value of a radio button.
https://gist.github.com/strangerstudios/9120040#file-my_pmpro_checkout_level-php
I tried to replicate but I was not able to make it works.Anyway, from this information I could deduce that the idea that I need to apply to get what I published above, is to read the value of the radio button of the Payment Method.
The problem that is I deduced that the name of such radio button could be ‘gateway’, but I think that it should be documented (I did not find any information about it).
Thanks