Hello,
Thank you Stephen for your support, its been excellent. Your plugin does everything that we need, and getting such quick responses to questions really confirms the decision to use Event organiser.
Ok, so here’s the next question –
I have to upload 80 events with tickets for each one. I can do a bulk upload of the events themselves, but how do i set up all the tickets? They will all be the same ticket, but specific to the event. i.e. the ticket has to be named so that they identify the event that they are for.
As always, any help gratefully received.

CYCOffice
Hi Louise,
Unfortunately there is no import feature for tickets, so this would have to be scripted. I can provide an example snippet, but are you selling by date or.by series?

Stephen Harris
Hello Stephen,
We are issuing tickets per day for events. It would be great if you can provide a snippet.
Thanks again

CYCOffice
Here’s a snippet that will create a ticket for all occurrences of a given event (I wasn’t sure if the ticket would be identical across all events):
$event_id = ''; //Set event ID here
//Ticket definition - this will created for each occurrence
$ticket = array(
'name' => 'Name of the ticket',
'price' => '5.10',
'spaces' => 100,
'order' => 0, //optional, for multiple tickets specify an order (0 = highest)
//optional, datetime object. Ticket available from this date
'from' => new DateTime( 'last week', eo_get_blog_timezone() ),
//optional, datetime object. Ticket available until this date
'to' => new DateTime( 'next year', eo_get_blog_timezone() ),
);
$occurrences = eo_get_the_occurrences_of( $event_id );
$ticket['occurrence_ids'] = array_keys( $occurrences );
eventorganiser_insert_ticket( $event_id, $ticket );
Are you happy to take it from there or do you need any more assistance in getting this into a usable state?

Stephen Harris
Hello Stephen,
I tried to work out how to incorporate a script into my wordpress admin, but it has me beaten.
I would appreciate some help.
Ideally, i would like to be able to create a csv file with the ticket information for all 80 events, and be able to load it from the admin area.

CYCOffice
Ok, is there anything in particular you are stuck with?

Stephen Harris
I have not been able to find how to open a csv file and read its contents. All my php to date has been modifying existing structures.
I’m not sure how to start with reading the csv file then looping through each line to extract the ticket information so that I can load it into the code snippet you provided.
Any help (or links to resources I should read) greatly appreciated.

CYCOffice
Hi Louise,
You may want to take a look at https://github.com/stephenharris/Event-Organiser-CSV
It’s for importing events but if you’re happy making modifications then it may help.
You’ll want to specify the columns that you’ll be using here: https://github.com/stephenharris/Event-Organiser-CSV/blob/master/event-organiser-csv.php#L64
Create your own parser here: https://github.com/stephenharris/Event-Organiser-CSV/blob/master/includes/admin.php#L208 ( the one for events is defined here: https://github.com/stephenharris/Event-Organiser-CSV/blob/master/includes/class-eo-event-csv-parser.php – it just defines how the data in the CSV is understood – e.g. a value in the start column is interpreted to be a date/time).
And you’ll want to replace this chunk with a foreach loop over the imported items to create the tickets.
I hope that helps!

Stephen Harris