Ticket information in the "meta", I want it isolated. [solved]

Home Forums Ticket Products Event Tickets Plus Ticket information in the "meta", I want it isolated. [solved]

Viewing 4 posts - 16 through 19 (of 19 total)
  • Author
    Posts
  • #65432
    frangotier
    Participant

    In the meantime, to show the price of a concert I still use the tribe_get_cost() function which I put back in place like Kelly said. But I would like to avoid to the organizer the confusion of typing the same price two times, once in the ticket field and then in the Event cost field.

    #65471
    frangotier
    Participant

    Got it!
    First I store the current event ID in a variable, then I look in the base which post have a key ‘_tribe_wooticket_for_event’, and among these which one has it equal to the ID of the event.
    I store HIS ID in a new variable.
    I use that variable in the get_post_meta() function.
    I even grabbed the currency symbol to display it behind and not before the price.

    $id = get_the_ID();
    global $wpdb;
    $mos_articles = $wpdb->get_results(

    SELECT post_id
    FROM $wpdb->postmeta
    WHERE meta_key = ‘_tribe_wooticket_for_event’
    AND meta_value='” .$id. “‘

    );
    foreach ( $mos_articles as $mon_bilhet )
    {
    $mon_bon_bilhet = $mon_bilhet->post_id;
    }
    $meta_monuda = get_post_meta( get_the_ID(), ‘_EventCurrencySymbol’, true );
    $meta_pretz = get_post_meta( $mon_bon_bilhet, ‘_regular_price’, true );
    echo ‘|’.$meta_pretz.’ ‘.$meta_monuda. ”;

    Thank you for telling me if this non-academic workaround can cause any problem.

    #66238
    Chris
    Participant

    Hi there,
    If it works, thats good, but thats definately not an ideal solution. When this update comes out, you’ll be able to do:

    $event_id = get_the_ID();
    // Get the singleton instance
    $woo = TribeWooTickets::get_instance();
    // Get an array of WooCommerce products IDs associated with this event
    $all_tickets = $woo->get_tickets_ids( $event_id );
    // Get just the first one, if the user wants that
    $first_ticket = array_shift( $all_tickets );
    // print price
    $price = get_post_meta( $first_ticket, ‘_regular_price’, true );
    echo $price;

    -Chris

    #981091
    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 4 posts - 16 through 19 (of 19 total)
  • The topic ‘Ticket information in the "meta", I want it isolated. [solved]’ is closed to new replies.