Posted: October 30, 2024 at 9:44 am
Several years ago I had received help via this forum to have the Promo Code addon only allow the codes to be applied to “Regular” tickets. The final solution created and is visible near the bottom of this thread: Unfortunately, this has stopped working as intended and it is denying Promo Codes on all ticket types. We have not made any changes to this code (used in a plugin) since we implemented it. Can you point me in the right direction to see why the ticket filter is no able to identify tickets with the name “Regular”? Thanks |
|
Hi there, I’ve just gone through and tested that snippet locally and it appears to be working correctly for me: https://monosnap.com/file/NOtoRWunBtyGjGsLenhXAoaMWF2iY7 Thats exactly the same event with a ticket called ‘Regular’ and ‘Admission’, like this: https://monosnap.com/file/8j4XHWsVKwEUyxZ2l3cSLYWsHwxi1B The promotion is TEST and is a 50% discount, applied to the event in question: https://monosnap.com/file/xAkctKu3ZA5jsO9d8TWHr4UdFcUAPv and: https://monosnap.com/file/KtZFyQs0AQNmYO3GVTArozZvdCsIqh (Note this is a new, clan site I’ve just spun up for testing this, so it only has this event and that single promotion) Am I using a different setup to you here? |
|
I had only been testing using existing codes created by the site administrator. I have created some of my own test codes and when I first create them they work on both Regular and other tickets, not what we want. Once I have tested them a couple of times and not made any changes to them, they are then denied on non-Regular tickets but when using them on the Regular tickets I get the following error “An unknown error occurred on the server while attempting to process your request. Please refresh the page and try again or contact support.” This is very difficult to debug with the inconsistent results but I will see if I can figure out the problem. Any insight you might have on the above error might be useful. Thanks |
|
To add to my previous comment, when I try any of our active codes on Regular tickets, I get this error: |
|
Will generally be from a fatal error being thrown and then either no response is received on the ajax request, or garbage is received and EE doesn’t know what to do. Check your servers error logs for fatal around when the above is thrown. Or add this snippet to your sites wp-config.php file: https://eventespresso.com/wiki/troubleshooting-checklist/#wpdebug THen retest until you get the above. Then check in /wp-content/debug.log for any errors |
|
Thanks for that. I have enabled the error logging and this appears to be the relevant error generated: [01-Nov-2024 21:45:24 UTC] PHP Fatal error: Uncaught DivisionByZeroError: Division by zero in /nas/content/live/aprthemetest1/wp-content/plugins/eea-promotions/lib/scopes/EE_Promotion_Event_Scope.lib.php:643 Does this tell you anything useful? |
|
It tells me the ticket_count is being returned as 0 and the code is then using that to try and devied the promotion value. This code:
So When is why you have line items for a ticket which have a QTY of 0. How are you testing this? |
|
This reply has been marked as private. | |
The support post ‘Promo Code Problem’ 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.