Support

Home Forums Event Espresso Premium Free Additional Attendee

Free Additional Attendee

Posted: November 6, 2014 at 1:57 pm

Viewing 12 reply threads


Pixel Workshop

November 6, 2014 at 1:57 pm

Is there a way in EE3 to have an additional attendee be free without using MER? My client wants to let every attendee bring a guest without additional charge.

Thanks!


Josh

  • Support Staff

November 6, 2014 at 2:14 pm

Hi there,

Event Espresso 3 doesn’t have a buy one get one promotion feature. One work-around that may do the job is have a 50% discount code could be applied, but you’d likely need to prevent the discount code box from being input into until there’s an even number of attendees selected. Which could be done with a bit of jQuery added to the registration form page.


Pixel Workshop

November 6, 2014 at 2:35 pm

That could work.

I was also thinking of making up a price modifier question with a negative value that would zero out the second person’s fee, but I wouldn’t want it to show the negative price value. Is there a way to hide the price?


Pixel Workshop

November 6, 2014 at 2:50 pm

Then I found this thread, and this might be the most elegant solution. Would this kind of thing still work?

https://eventespresso.com/topic/additional-attendees-different-pricing/


Josh

  • Support Staff

November 6, 2014 at 3:07 pm

Have you tried the price modifier with a negative value? I’m not aware that it allows for a negative price. If it did, you could apply a content filter to move the part where it displays price value in the html spans that display on the page.


Pixel Workshop

November 6, 2014 at 3:24 pm

I haven’t but I thought you could have a negative value as long as the total did end up in the negative. I could be wrong on that, but I’ll check it out. And I’m going to try Sidney’s solution too.


Dean

November 7, 2014 at 2:10 am

Please let us know how you get on and if you need further assistance.


Pixel Workshop

November 10, 2014 at 2:41 pm

Thanks, Dean. So, I think I’m doing what Sidney suggested, but I’m getting an error that suggests the registration ID is being misinterpreted because of the “-” between the event ID and the rest of the number. Is there a way to get around that? I assume it comes up elsewhere.

[Mon Nov 10 19:42:28 2014] [error] [client 68.50.209.40] WordPress database error Unknown column ‘54611524c81a1’ in ‘where clause’ for query SELECT * FROM wp_17_events_attendee WHERE registration_id=50-54611524c81a1 /* From [ulmanfund-trispies-com.trispies.staging.wpengine.com/event-registration/] in [/nas/wp/www/staging/trispies/wp-content/uploads/espresso/custom_functions.php:367] */ made by require(‘wp-blog-header.php’), require_once(‘wp-load.php’), require_once(‘wp-config.php’), require_once(‘wp-settings.php’), do_action(‘init’), call_user_func_array, event_espresso_run, event_espresso_add_attendees_to_db, do_action(‘action_hook_espresso_save_attendee_data’), call_user_func_array, espresso_make_additional_relay_teammates_free, referer: http://ulmanfund-trispies-com.trispies.staging.wpengine.com/events/2014-columbia-triathlon-relay/

function espresso_make_additional_relay_teammates_free ($ext_att_data_source) {
    global $wpdb;
    $attendee = $wpdb->get_row('SELECT * FROM ' . EVENTS_ATTENDEE_TABLE . ' WHERE id=' . $ext_att_data_source['attendee_id'], ARRAY_A);
    $teammate = $wpdb->get_row('SELECT * FROM ' . EVENTS_ATTENDEE_TABLE . ' WHERE registration_id=' . $attendee['registration_id'], ARRAY_A);

    
    if ($teammate['is_primary'] != 1) {
        $wpdb->update(EVENTS_ATTENDEE_TABLE,
                array('final_price'=>'0.00'),
                array('id'=>$attendee['id']),
                array('%s'),
                array('%d'));
    }
}
 
add_action('action_hook_espresso_save_attendee_data', 'espresso_make_additional_relay_teammates_free');

$ext_att_data_source['attendee_id'] = $ext_attendee_id;


Dean

November 11, 2014 at 1:36 am

There’s a couple of issues with that code. I have added a modified version here: https://gist.github.com/Apina/c341a2af96017f983bd3

That should stop the database error, and will also make ALL additional attendees free.


Pixel Workshop

November 11, 2014 at 12:09 pm

That stopped the MySQL errors, but isn’t changing the price to $0. I’m putting the code in the custom_functions.php file, should I put it someplace else?


Josh

  • Support Staff

November 11, 2014 at 3:20 pm

Hi there,

That’s a good enough place to put the code. You could try echoing out something if you don’t think the code is being executed though.

Another thing that you can check for is that hook where Sidney said to change in EE3 core. That’s been fixed in the EE 3.1.37 pre-release, but if you’re on 3.1.36, you’ll need to change the hook like Sidney showed in the gist.


Pixel Workshop

November 12, 2014 at 9:24 am

It was the hook. In Sidney’s notes it said the bug was 3.1.36.1.P and while I was on a later version, its not yet 3.1.37.

Thanks, Josh! You guys are awesome. Its really comforting to know that you all are here and have our backs!

Have a great day!


Josh

  • Support Staff

November 12, 2014 at 11:54 am

You’re welcome.

Viewing 12 reply threads

The support post ‘Free Additional Attendee’ 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