Support

Home Forums Event Espresso Premium Adding Price Column

Adding Price Column

Posted: August 1, 2016 at 2:17 pm

Viewing 3 reply threads


Toufan Rahimpour

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!


Tony

  • Support Staff

August 1, 2016 at 3:58 pm

Warning: reset() expects parameter 1 to be array, string given

Means your passing a string to reset() rather than an array, likely because your first event does not have an ‘active’ tickets so whichever method you are using to return the prices is actually returning an empty string, your then passing that to reset (which doesn’t know what to do with it).

Are you following a tutorial to add the column?

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”.

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.


Toufan Rahimpour

August 1, 2016 at 5:24 pm

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!


Tony

  • Support Staff

August 2, 2016 at 6:26 am

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.

Viewing 3 reply threads

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.

Event Espresso