Posted: August 1, 2016 at 2:17 pm
|
I’ve been working on adding a price column and I have it almost all figured out, but I’m getting a php error. (https://pursuitservices.com/training/) Also I was wondering if I could get help adding some php code for when the event hasn’t gone on sale yet to display “TBA”. Thanks in advance! |
Means your passing a string to Are you following a tutorial to add the column?
Do you mean if all of the tickets have the ‘goes on sale’ date set to a date within the future? You’ll need to check the status of all the tickets for that. We don’t provide support for custom coding, but can usually help point you in the right direction, if you you post your current template to http://pastebin.com/ or create a gist and post the link here we can take a look. |
|
|
Okay great! Yes I follow the tutorial where it was applicable and have everything working great, but evidently the tickets for my first event are yet to go on sale which is what is giving me an error. So I guess all I need it the php for this: in the event the tickets are yet to go on sale > show TBA. I just pasted in paste bin: http://pastebin.com/xwwVEBrD I know it is a simple code, but am just stumped. Thanks! |
You need to check if $tickets is an array before using reset() on it. If its not an array the event is returning now available tickets, but your within a sold_out check so the event isn’t sold out, its just got no available tickets which means something like this: //check if $tickets is and array if( is_array( $tickets ) ) { // grab first ticket from array $ticket = reset( $tickets ); } else { //No tickets have been returned, set $ticket to NULL and set the text to display TBA $ticket = NULL; $ticket_price = __( 'TBA', 'event_espresso' ); } Should work for what you need. Use that in place of line 107 and 108 on your pastebin. |
|
The support post ‘Adding Price Column’ 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.