Support

Home Forums Event Espresso Premium Ajax process SSN undefined

Ajax process SSN undefined

Posted: January 11, 2024 at 9:28 am

Viewing 4 reply threads


TheFreshUK

January 11, 2024 at 9:28 am

Trying to get my head around how the SPCO understands what cart to apply to. I have added the promotions addon, however due to the fact adds the promo code on the payment options step and we’ve customised this to automatically redirect to the only payment option we support (a custom one). I’ve tried to move the input for processing the promo code.

After having multiple failures at doing this, I’ve added my own input and ajax call to an endpoint that uses the promotions submit promo code endpoint. However, I get:

Uncaught Error: Call to a member function cart() on null in /var/www/html/wp-content/plugins/eea-promotions/EED_Promotions.module.php:750

Trying to figure out how promotions.js passes this information so that EE_Registry::instance()->SSN->cart(); is initiated


Brent Christensen

  • Support Staff

January 12, 2024 at 3:11 pm

Hi @TheFreshUK,

I’m Event Espresso’s lead developer. Is your code uploaded anywhere public, like GitHub, where I can take a look at it? Without seeing your actual code it’s difficult to give you an accurate response. That said, here’s a couple of things to consider:

– your AJAX requests will need to include the session key in a parameter named EESID. If you look at the plugins/eea-promotions/scripts/promotions.js file you can see how this is done there. This should get automagically picked up when the session loads and allow it to retreive the correct cart. If you are not already doing this, then this is almost certainly the issue. If you are doing this already, then I will very likely need to see your code.

– the Event Espresso session is loaded during the WordPress init hook at priority 9, so you will need to make sure that your code is running AFTER that. To ensure this, it would be best to hook your logic into AHEE__EE_System__core_loaded_and_ready.

Let me know if that helps or your need me to look at the code directly.


TheFreshUK

January 15, 2024 at 2:19 am

This reply has been marked as private.


Brent Christensen

  • Support Staff

January 15, 2024 at 11:24 am

Hi @thefreshuk,

Thanks for posting some code for me to look at.

Can’t test your code fully, because obviously you’ve changed a bunch of things up and i don’t have access to everything else you have done, but pretty sure the problem with the code you’ve posted is:

– line 10 of discount.js
– the boolean flag used to detect EE AJAX requests (and therefore how to know to load stuff) is named ee_front_ajax not front_ajax

as soon as I fixed that, things appear to work correctly.


TheFreshUK

January 16, 2024 at 1:55 am

You’re a legend Brent as always! that fixed it. Thanks!

Viewing 4 reply threads

The support post ‘Ajax process SSN undefined’ 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