Home › Forums › Calendar Products › Events Calendar PRO › Event Cost Field ID
- This topic has 7 replies, 3 voices, and was last updated 10 years, 9 months ago by
Support Droid.
-
AuthorPosts
-
November 1, 2012 at 1:46 pm #27469
Neil Heird
ParticipantHello. 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;
November 1, 2012 at 1:50 pm #27470Neil Heird
ParticipantHello again, one more question:
how do I get the price “outside the loop”, given a post ID
November 2, 2012 at 6:00 am #27479Barry
MemberSo 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 IDDoes that help here?
November 8, 2012 at 2:55 pm #27736Barry
MemberHi Neil, do you need further help or are you all sorted here?
November 8, 2012 at 5:03 pm #27757Neil Heird
ParticipantHi 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
November 8, 2012 at 5:04 pm #27758Neil Heird
Participantguess I shouldve read higher up. you answered my question so thanks a million!
November 9, 2012 at 7:38 am #27776Barry
MemberExcellent, 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!
July 7, 2015 at 6:26 am #978136Support Droid
KeymasterThis 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. -
AuthorPosts
- The topic ‘Event Cost Field ID’ is closed to new replies.
