Posted: September 23, 2015 at 8:06 am
|
Our ‘Places Left’ (remaining tickets) script has stopped working after EE ver 4.4.6 and fails to calculate dates and ticket numbers. We use a personalised script to calculate the remaining number of tickets for each event (Training Course) that we sell. I have read through the recent datetime changes but, as I am not an experienced developer, I am not understanding how to change my script to work with the new EE versions. It’s probably something simple so I apologise for my lack of knowledge. In order for our site to still operate I have temporarily left it with EE ver 4.4.6 (WP 4.3.1) whilst setting up a development site with EE ver 4.8.9.p (WP 4.3.1) to demonstrate the problems. I have purchased a Support Token |
Hi there, We’re reviewing the files on your theme and we’ll update you with what we find. Thanks. |
|
September 23, 2015 at 11:10 am Hi there, Here’s how you can update your code to work with later versions of Event Espresso 4: 1) Where you currently have this:
You change it to this:
2) Then for the Places Left code, you change this:
to this:
Hope that helps! |
|
|
September 23, 2015 at 11:14 am Hi Thanks for the quick response Josh – much appreciated. I’ll try that in my code right away. Lesley |
September 23, 2015 at 11:42 am You’re welcome. |
|
|
Hi Josh The code is working perfectly on the individual course pages now, which is great!. I am still having a problem on other pages however – specifically the homepage, the event listing page and the event archive page – where the courses are displayed in ‘card’ view. I have tried to alter the code for these pages myself, based on your earlier example, but I can either get the date to be correct or the ‘Places Left’ to be correct but not both – not sure how to proceed so would value your input. Pages where the courses are displayed in card view: Files: => t-5-courses.php …/staging/5/wp-content/themes/creative-tourismgrowth/_/inc/ => cn-single-related-event.php /……………………………/ Really hope you can help. |
Hi Lesley, For that t-5-courses.php and similar templates, the date variables look like they should still work, because the espresso_event_date() function will still return an event date. You should be able to leave that code as-is. For the $ticket_total and $ticket_sold variables, you’ll need to change the way you get those variables. So, where you have this currently:
You can change it to this:
|
|
|
Hi Josh That’s excellent – thanks for getting back to me so quickly 🙂 Lesley |
You’re welcome. |
|
|
Everything is working perfectly now – thanks again for all your help. Have a great day 😉 Lesley |
You too! |
|
The support post ‘DateTime 'Places Left' conflict – with EE4 versions after 4.4.6’ 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.