Page 1 of 1

Hook/Filter to change order of Card Type Options?

PostPosted: April 22nd, 2011, 3:11 am
by toddz88
Is there a Hook/Filter to change the array order of Card Type Options / Billing Methods, in s2member Pro?

GOAL: On the s2Member Pro checkout form (template: paypal-checkout-form.html), I need to change the order in which the Billing Methods are displayed (by %%card_type_options%%), making Paypal the last option, rather than the first (since we can't remove it entirely).

Apparently the ShortCode does not actually control the order of display. I was able to use CSS to float it to the right, but that's a bit hacky and the spacing between Paypal and the others isn't perfect.

Then I found the line of code that actually sets the order, in this file:
s2member-pro/includes/classes/gateways/paypal/paypal-form-in.inc.php
So I can edit the array, putting Paypal last. But i also know it's unwise to edit the plugin files like this, as my changes will be lost in future updates. Can this be done with a Hook or Filter instead?

Thanks,
Todd

Re: Hook/Filter to change order of Card Type Options?

PostPosted: April 22nd, 2011, 2:52 pm
by Cristián Lávaque
Hmm... I'm looking at the file (s2member-pro/includes/classes/gateways/paypal/paypal-form-in.inc.php).

Try the hook "ws_plugin__s2member_pro_before_sc_paypal_form_after_shortcode_atts" (line 69).

Let me know if that helps. :)

Re: Hook/Filter to change order of Card Type Options?

PostPosted: April 22nd, 2011, 11:51 pm
by toddz88
I haven't gone back to this yet, but the hook you suggested was my inspiration for the dynamic shortcode idea. Thanks!!

Re: Hook/Filter to change order of Card Type Options?

PostPosted: April 23rd, 2011, 12:04 am
by Cristián Lávaque
Very cool! I'm glad I was able to help you. :)