Posted: October 23, 2018 at 9:25 am
|
I’ve figured out how to get most of the fields I want to display in my Events Table View Template Add-on modifications, except when I try to get my own custom fields (formerly event_meta fields), I am using this: <?php get_post_meta($post->ID, 'instructor', true); ?> but it is coming back empty, despite the fact that I can see it when I edit my event. What am I doing wrong? Also, how can I make the Add to Cart button use AJAX like it used to in EE3 and come right back to the same page? And finally, how can I make the Add to Cart button show a Waitlist button instead if the event is sold out, and let the users add it to the cart to save their info as a waitlist registration? |
Hi there,
How did you add the ‘instructor’ field? Are you sure the meta key for the field is just ‘instructor’? Note if you have the EE_Event object, which the table view template does within
To do the same without passing the ID (the event object does it for you).
Thats not something we currently have for EE4, or at least, not in the same way it did with EE3. EE3 added the events to the cart and then allowed you to select the tickets for each event in the cart before you could check out. EE4 uses the Ticket Selector to display the tickets for the event, the user selects the specific tickets they need and then adds them to the cart directly from there. As you are referring to the Event Table template, I’m assuming you want to add the tickets directly from that, which you can do using this template:
The waitlist button is added within the ticket selector, so if you show the ticket selector using the above, this would happen automatically for you. |
|
|
I tried using $event->get_post_meta('instructor', true); and that also came back empty. I am using the default template provided with the add-on, and just added some columns to the display. So I do have the $event object, yet… where is that info? Is there a way I can query for it using phpMyAdmin on the backend to make sure it’s there? But it does show on the event editing page. Regarding the AJAX add to cart option, does the sessions till hold the cart variables the way it used to? Maybe I could use some of the old EE3 code when modifying my table. All of our classes only have one ticket type right now (although we may branch out for certain one-day workshops), so the desired behavior is to have the Add to Cart button add one ticket of the only ticket option there is, and if they need more than one, they can edit that in the cart. And if the class is full, the button in the table would hold a spot in the waitlist. Is there a way to do that easily? Also, do the seats get pulled out of the database at the moment they are added to the cart, even before checkout is completed? We often have a rush on registration day, and it has been an issue in the past if people lost their seat while filling out their forms. |
Ok, so that sounds like you don’t have a custom field with the key ‘instructor’.
You’ll see:
You’ll also see:
That’s the EE_Event object attached to the post being used to pull the extrnal_url.
What exactly do you see on the event editor? Can you add a screenshot? https://eventespresso.com/wiki/troubleshooting-checklist/#screenshots
It still holds a session, but in a completely different way. EE4 was a complete rebuild of EE, its not simply an update to a new version, but a completely different system.
You’ll need to use the ticket selector, you can hide sections of it using CSS, but there’s no single button submission with EE4 like there was with EE3. Can you post a link to what you have now?
EE places your ticket selections on reserve for the duration of your session (by default 1 hour), so if you have 2 tickets left and a user selects those 2 tickets but it still adding their details to the forms and the next user loads the event/ticket selector for the event, the new user will see no tickets available (sold out). If the first user doesn’t complete their registration the tickets are released and the next user to load the ticket selector can select them. |
|
|
I am certain I do (instructor, day_of_week, etc.), and they are visible in the custom fields section when I edit the event, just like this guy’s screen grab: https://drive.google.com/file/d/0B2KCao4zFjaxWU53Yi11eDVDdlU/view I tried all of these variations with no luck: $post->EE_Event->get_post_meta('day_of_week', true); $event->get_post_meta('day_of_week', true); get_post_meta($post->ID, 'day_of_week', true); Clearly I’m missing something here, probably something easy and obvious! Thanks for your help. |
|
Also, when I try to use the debugging framework, e.g. d( $post ); I get a fatal error, Call to undefined function d(). I have the template in my child theme folder. |
|
Oh my goodness, I knew it was something obvious. All three of the methods I tried *do* work when you remember to echo them to the screen, not just retrieve them! Oops. I still don’t know why the debug framework is throwing an error, though. And I will look into hiding what I don’t need of the ticket selector, or perhaps customizing it to just show the Add to Cart or Waitlist buttons, as appropriate. Thanks! |
Hi Laura, You’ll need to install a kint debugging plugin in order to use its There are a few options available to download from wordpress.org: |
|
The support post ‘Retrieve custom fields in Event Table View Add-On’ 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.