Home › Forums › Ticket Products › Event Tickets Plus › 500 Internal Server Error on admin-ajax.php when editing RSVP ticket
- This topic has 7 replies, 4 voices, and was last updated 9 years, 3 months ago by
Scott Anderson.
-
AuthorPosts
-
January 11, 2017 at 8:06 am #1216540
Scott Anderson
ParticipantMy issue is similar to the problem identified in this thread but the solution there did not solve the problem.
My client is running Event Tickets Plus with WooCommerce, and also offers some free events with RSVP only. The client reported being unable to edit an existing ticket. Specifically, the issue is with editing a ticket that is only RSVP, no paid (WooCommerce) tickets.
I tested and found that clicking Edit causes the ticket postbox to gray out for a few seconds, and then nothing else happens. Console indicates a 500 Internal Server Error on the call to admin-ajax.php.
Turning on WP_DEBUG revealed the following error message:
PHP Fatal error: Call to a member function get_stock_quantity() on a non-object in /[PATH]/wp-content/plugins/event-tickets-plus/src/Tribe/Commerce/WooCommerce/Main.php on line 1222That line reads:
$actual_stock = wc_get_product( $ticket_id )->get_stock_quantity();My thought here is that since there’s no WooCommerce ticket, the
wc_get_product()function is returning false/null instead of an object; hence the error.I change the line to the following…
$actual_stock = (wc_get_product( $ticket_id )) ? wc_get_product( $ticket_id )->get_stock_quantity() : 0;…and confirmed that it appears to resolve the issue.
January 11, 2017 at 4:34 pm #1217059George
ParticipantHey Scott,
I’m really sorry to hear about this fatal—I don’t see this myself, and we’re not seeing other reports of this from other customers, so I’m a bit stumped as to why this is happening.
I’ve reached out to our developers to see if we can figure out what’s happening here—I will keep this thread updated with news based on what they say and determine.
I’m glad you’ve got a temporary solution that’s working now—stay tuned for more information on this!
— George
January 12, 2017 at 5:49 am #1217317Scott Anderson
ParticipantHi George,
Thanks for your reply. I’m not entirely sure what’s going on with the client site. For troubleshooting I set up a partial mirror of the client’s site — that is, I set up a new WordPress site and installed the client’s custom theme and all of their plugins, but for time and logistics reasons I did not copy over all of their content. On my mirror site I could not replicate the issue. (My staging server is also running a different version of PHP than the client’s live server, which might be a factor.)
Anyway, I went back to the client site and did confirm that the problem was specifically happening only on RSVP-only events, and narrowed it down to this one line of code.
I would make the suggestion that it would be worth considering adding this change to the plugin even if you’re not able to replicate the problem, because as written it’s assuming that an external (WooCommerce) function is always going to return an object, which in some cases it may not.
(I should also note that as I wrote it in my original post, the code is not efficient — it’s calling the WooCommerce function twice unnecessarily. I’ve modified my own version to assign its value to a variable and then return the variable in the ternary statement, rather than calling the function again.)
-
This reply was modified 9 years, 3 months ago by
Scott Anderson. Reason: Added an additional comment
January 13, 2017 at 1:43 am #1217950George
ParticipantHey Scott,
A developer on our team, Barry, has helped me dive a bit deeper on this, and we’ve indeed identified a bug. It’s tricky to get it to replicate, but is a valid bug nonetheless and I will update this thread when there is a fix available for it.
There’s no specific ETA for the arrival of that fix yet, but I will post here when there’s news about it! If there’s no post from me, there’s no news—otherwise, stay tuned to this thread to be notified of when a fix is available for the bug you describe.
Sorry for the trouble! Please let me know if there are any other issues or questions I can try to help with.
— George
January 26, 2017 at 8:57 pm #1224885Nico
MemberHey,
I’m reaching out to let you know that we just released a fix for this issue. Please update the plugins to version 4.4.1 (4.4.1.1 for The Events Calendar) and let us know if this actually makes the issue right in your site.
More details on the release → Maintenance Release: The Events Calendar and Event Tickets 4.4.1, plus premium add-ons
Best,
NicoJanuary 27, 2017 at 7:34 am #1225145Scott Anderson
ParticipantThanks Nico. I just ran the update and tested it out, and it looks like the problem is fixed. I also reviewed the source code of the updated version and saw essentially my same code edit (the more efficient version) in place.
Thanks to the team for all of the great work on these plugins!
January 27, 2017 at 10:12 am #1225279George
ParticipantThanks for your patience with all of this, Scott!
Glad to hear things are working again.
I’ll close this thread for now, but feel free to open a new thread any time if other issues or questions arise.
Cheers,
George -
This reply was modified 9 years, 3 months ago by
-
AuthorPosts
- The topic ‘500 Internal Server Error on admin-ajax.php when editing RSVP ticket’ is closed to new replies.
