Support

Home Forums Event Espresso Premium Using my_meta_key in place of 'Number of Tickets' – Can It Be Done?

Using my_meta_key in place of 'Number of Tickets' – Can It Be Done?

Posted: May 16, 2013 at 11:59 am


Jeanette Green

May 16, 2013 at 11:59 am

Hey Chaps,

My client has a rather complicated pricing structure which we are trying to get around. First a clarification, we are using espresso for sports coaches to sign up their various teams to events, so we’re essentially selling ‘team entries’ rather than tickets to the public, if that makes sense.

So with that in mind, for some events, she charges per team and for some she charges per age group. We are essentially using ‘tickets’ as a means of totalling up an event booking.

To cut a long story short, we want to continue to use tickets as a way of totalling up an order, but we need to be able to change some wording beside the ticket selection based on the pricing structure for the event. Is there a way of removing the ‘Number of Tickets’ wording from the below piece of code, and replacing it with a my_meta_key, which she can then use to either type ‘Number of Teams’ or ‘Number of Age Groups’ into each event she creates??

[code]echo event_espresso_additional_attendees($event_id, $additional_limit, $number_available_spaces, __(‘Number of Tickets’, ‘event_espresso’), true, $event_meta);[/code]


Dean

May 17, 2013 at 4:40 am

Hi,

If you have no objection to editing a php template, then what I would do is edit the registration_page_display.php and where it says (approx line 238)

echo event_espresso_additional_attendees($event_id, $additional_limit, $number_available_spaces, __('Number of Tickets', 'event_espresso'), true, $event_meta);

Change it to

$dean = do_shortcode('[EE_META type="event_meta" name="one"]');
if($dean != '') {
echo event_espresso_additional_attendees($event_id, $additional_limit, $number_available_spaces, $dean, true, $event_meta);
} else {
echo event_espresso_additional_attendees($event_id, $additional_limit, $number_available_spaces, __('Number of Tickets', 'event_espresso'), true, $event_meta);	
}

Change the XXXXX to the name of the custom meta field.

So all this does is grab the meta field content and check if it is empty, if not it uses the value of the meta field, if it is empty it shows the default Number of Tickets.


Jeanette Green

May 17, 2013 at 8:53 am

Aghhhh Dean, you LEGEND!!! Worked perfectly. Thanks very much mate.


Jeanette Green

May 17, 2013 at 12:55 pm

Dean, could we go one step further and make the Event Meta ‘Key’ a default one, much like you’ve done with the Event_hashtag, Event_format, and Event_livestreamed?

Is there much involved to doing that?


Josh

  • Support Staff

May 17, 2013 at 4:10 pm

There is some sample code in the ee-meta documentation that you can modify and copy to the custom files add-on’s custom_functions.php file. The first value is the meta key, and the second value is the default value.

https://eventespresso.com/wiki/shortcodes-template-variables/#ee-meta


Jeanette Green

May 18, 2013 at 7:13 am

Thanks Josh,

Id love access to the custom_functions.php file, but it won’t let me. Says I need a business licence, or a VIP membership. As you can see from my account, I do have VIP membership, but not a business license.

Not sure how to get those files?!?


Dean

May 20, 2013 at 4:38 am

I am sorry if this is a duplicate, I thought I had responded earlier to this.

Basically, the documentation should be available to view, I logged in under your account and viewed it with no issues.

The Custom Files add on, is only available via the Business Licence or a separate purchase.


Jeanette Green

May 20, 2013 at 7:12 am

Hi Dean,

Yes I can see the small amount of documentation on the custom files addon, (one paragraph and a yellow info box saying i need a business license OR VIP access) – I don’t have a business license, but I have purchased VIP Access, so I should be able to access custom_functions.php, no?

 


Josh

  • Support Staff

May 20, 2013 at 9:57 am

Hi there,

You only get access to the files for products you own. Since the custom files add-on isn’t included with the personal license, you’d need to purchase the custom files add-on separately or upgrade to the business license.


Jeanette Green

May 20, 2013 at 2:13 pm

I see. No worries, thanks Josh.


Dean

May 21, 2013 at 1:50 am

Hi Jeanette,

We are now currently working on giving VIP’s access to all/most of the documentation, regardless of ownership. Obviously though to make use of the documentation you will need the appropriate licence/add plugin.


Jeanette Green

May 21, 2013 at 5:25 pm

Yes that makes sense Dean. I shall contact my client (Jeanette) and recommend purchasing the plugin you guys are suggesting.

Best,

Andrew

The support post ‘Using my_meta_key in place of 'Number of Tickets' – Can It Be Done?’ 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