Event Cost Field ID

Home Forums Calendar Products Events Calendar PRO Event Cost Field ID

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #27469
    Neil Heird
    Participant

    Hello. I am working on a custom solution that uses Gravity Forms. Specifically, I am build an event registration form that is dynamically updated as new events are created using your plugin. With Jonah’s help I have successfully mapped the ‘tribe_events’ custom field id to the registration form. Now, I would like to also include the pricing information associated a given event. Example – if event A costs $10 to attend and event B costs $15, when I select event A from the registration form’s drop down, I would also like to both SEE the event’s price in a field that is dynamically updated, as well as PASS THROUGH the cost information to paypal when the form is submitted. Here is the form’s code located in my functions.php file, I just can’t figure out the COST field ID… the ‘tribe_get_cost ()’ string isn’t working for me.

    add_filter(“gform_pre_render”, “populate_dropdown”);
    function populate_dropdown($form){

    //NOTE: replace 221 below with your actual form ID
    if($form[“id”] != 1)
    return $form;

    //NOTE: replace your_post_type below with your actual post type name
    $posts = get_posts( array(“post_type” => “tribe_events”) );

    //Creating drop down item array.
    $items = array();

    //Adding initial blank value.
    $items[] = array(“text” => “”, “value” => “”, “price” => “”);

    //Adding post titles to the items array
    foreach($posts as $post){
    $items[] = array(“text” => $post->post_title, “value” => $post->post_title, “price” => tribe_get_cost ());
    }

    //Adding items to field id 1. Replace 1 with your actual product field id.
    foreach($form[“fields”] as &$field)
    if($field[“id”] == 15){
    $field[“choices”] = $items;
    }

    return $form;

    #27470
    Neil Heird
    Participant

    Hello again, one more question:

    how do I get the price “outside the loop”, given a post ID

    #27479
    Barry
    Member

    So you simply use tribe_get_cost() and pass in the post ID for the event:

    $cost = tribe_get_cost(100); // Where 100 is the event ID

    Does that help here?

    #27736
    Barry
    Member

    Hi Neil, do you need further help or are you all sorted here?

    #27757
    Neil Heird
    Participant

    Hi Barry. Im still stuck. I think all I need help with from you is the correct field id# / names for both the EVENT NAME field (which I already have) and also the corresponding EVENT PRICE field.

    I am having to do a custom solve that allows for payment directly to Paypal without going thru Eventbrite. So instead of using your direct registration form, I am using Gravity Forms to create a universal event registration page that is dynamically updated.

    From each signle event displayed via TRIBE plugin, I am adding a custom “register” link. This leads to a master register form that is dynamically updated with the event name and price displayed on the previous page. from there, GF will process payment via Paypal.

    Just need correct field id #s to populate the registration form… and I’m open to other suggestions if you have them.

    thanks

    #27758
    Neil Heird
    Participant

    guess I shouldve read higher up. you answered my question so thanks a million!

    #27776
    Barry
    Member

    Excellent, glad to hear you’re all sorted here. I’ll close this thread now but if there is anything else please just create a new topic or email us. Thanks!

    #978136
    Support Droid
    Keymaster

    This topic has not been active for quite some time and will now be closed.

    If you still need assistance please simply open a new topic (linking to this one if necessary)
    and one of the team will be only too happy to help.

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Event Cost Field ID’ is closed to new replies.