Support

Home Forums Event Espresso Premium SagePay – Changing required fields – Postcode

SagePay – Changing required fields – Postcode

Posted: September 14, 2016 at 4:56 am

Viewing 19 reply threads


Alan Coyne

September 14, 2016 at 4:56 am

HI,

Follow up to https://eventespresso.com/topic/sagepay-changing-required-fields/

The solution on https://github.com/eventespresso/ee-code-snippet-library/blob/master/checkout/mn_billing_form_zip_optional_for_sagepay.php no longer works. On the Card details page , the Postcode is still required.

Any ideas?

Regards

alan


Tony

  • Support Staff

September 14, 2016 at 9:20 am

Hi Alan,

Where do you currently have that code on your site?

The reason I ask is I have just added the code to a test site using the SagePay add-on and it set the zip field to longer be required so it could be a load order issue.


Alan Coyne

September 14, 2016 at 9:27 am

HI Tony,

Its in my child themes functions file.

Rgds

Alan


Tony

  • Support Staff

September 15, 2016 at 4:07 am

Hmm, strange.

On testing that function it works fine in a child theme.

Can you try creating a Custom Functions Plugin and see if works for you there?


Alan Coyne

September 15, 2016 at 7:52 am

I just tried to install the Custom Functions PLugin but it conflicts with SendGrid
SendGrid: wp_mail has been declared by another process or plugin, so you won’t be able to use SendGrid until the conflict is solved.

SO I have disabled it again. I’m not able to test anymore today so will come back to any replies on Monday

Thanks

Alan


Tony

  • Support Staff

September 15, 2016 at 10:15 am

SendGrid: wp_mail has been declared by another process or plugin, so you won’t be able to use SendGrid until the conflict is solved.

That will only happen if the functions within your custom plugin de-declare the ‘wp_mail()’ function, if you’ve followed the steps on the above link that should not be the case.

If you’d like to post the contents of you custom plugin I can take a look, you’ll need to create a gist or use something like pastebin then post the link here for us to view.


Alan Coyne

September 15, 2016 at 10:21 am

Hi Tony,

I got error when I activated the custom functions plugin before adding any functions.

Rgds

Alan


Tony

  • Support Staff

September 15, 2016 at 3:05 pm

That doesn’t really make any sense, although its not that I don’t believe you.

It sounds like the sendgrid plugin is throwing a false positive when the plugin is activated as if all you have is a blank plugin with no functions it can’t override wp_mail().

Can you send me login details so I can take a quick look? If so please use:

https://eventespresso.com/send-login-details/


Alan Coyne

September 16, 2016 at 1:40 am

Apologies Tony, I misread your reply.

I installed a plugin called Custom Functions Plugin which through the error!! I’ll try the correct method you suggested Monday.

Rgds

Alan


Lorenzo Orlando Caum

  • Support Staff

September 16, 2016 at 11:13 am

Hi Alan,

You can also create a site specific plugin for your site. We have a tutorial for that here:

https://eventespresso.com/wiki/create-site-specific-plugin-wordpress-site/


Lorenzo


Alan Coyne

September 19, 2016 at 4:14 am

Hi Lorenzo,

No luck with the plugin solution. Its still saying Postcode required on SagePay Card details page. The code I added to custom plugin was
http://pastebin.com/pvpNUGNb

Regards

Alan


Tony

  • Support Staff

September 20, 2016 at 6:18 am

Hi Alan,

Can you link me to an event I can run a test registration on please?


Alan Coyne

September 20, 2016 at 6:51 am

https://www.iregister.ie/v2/events/run/


Tony

  • Support Staff

September 21, 2016 at 4:52 am

The function is running on your site, you can tell as Postcode no longer has the * next to the label indicating it is no longer set as require within EE.

However, the field has the aria-required attribute set to true – http://take.ms/UR5qX

It looks like that is what is causing the validation on the field but I don’t think that is added by EE itself. I have requested some feedback from one of our developers on this and will post any feedback they provide.


Alan Coyne

September 29, 2016 at 12:55 pm

Tony,

I’ve change code in EE_Billing_Attendee_Info_Form.form.php to EE_Text_Input( array( ‘required’=>FALSE and it works.

Could this be done elsewhere?

Rgds

Alan


Tony

  • Support Staff

October 4, 2016 at 11:22 am

OK, found the problem.

So you’ve changed this line:

'zip' => new EE_Text_Input( array( 'required'=>TRUE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-zip', 'html_label_text' => __( 'Zip', 'event_espresso' ) ) ),

to be:

'zip' => new EE_Text_Input( array( 'required'=>FALSE, 'html_class' => 'ee-billing-qstn ee-billing-qstn-zip', 'html_label_text' => __( 'Zip', 'event_espresso' ) ) ),

Is that right?

That’s almost the same as what the filter is doing, but the filter does it only for the instance of EE_Billing_Attendee_Info_Form used for SagePay and not all instances.

It’s an issue with the JS validation and will need a fix pushed to live, I will update this thread when it is pushed.


Alan Coyne

October 5, 2016 at 2:32 am

Thats Correct Tony.

Thanks for your help

Alan


Tony

  • Support Staff

October 6, 2016 at 4:40 am

Hi Alan,

The fix for this was pushed within 4.9.16.p

When you update your modification above will be removed however the filter above should now work as expected.


Alan Coyne

October 6, 2016 at 4:46 am

Thanks Tony


Tony

  • Support Staff

October 6, 2016 at 5:12 am

You’re most welcome.

If you run into any problems please do let me know.

Viewing 19 reply threads

The support post ‘SagePay – Changing required fields – Postcode’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso