Support

Home Forums Event Espresso Premium String comparison not working for cost in ticket template

String comparison not working for cost in ticket template

Posted: August 20, 2013 at 3:33 pm

Viewing 1 reply thread


Biebob

    August 20, 2013 at 3:33 pm

    Hi,

    I want to check for the price in the ticket template. When the price is 0, I want to display Reservation instead of EUR 0.00. However, this is not working for some reason. What can be the problem?

    <?php
    if (do_shortcode(‘[cost]’) == ‘EUR 0.00’) {
    echo “RESERVATION”;
    }else{
    echo do_shortcode(‘[cost]’);
    }
    ?>

    • This topic was modified 11 years, 1 month ago by Biebob.


    Dean

    • Support Staff

    August 21, 2013 at 2:46 am

    OK, well that had me baffled, and honestly still does. I see no reason why that won’t work.

    However, until a more seasoned developer laughs and tells us why, I have an alternative solution:

    <?php
    $test = $data->attendee->total_cost;
    $test2 = "0.00";
    if($test === $test2) { echo "yes"; } else { echo "no"; }
    ?>

    This grabs the value from the main array and uses that instead.

    Viewing 1 reply thread

    The support post ‘String comparison not working for cost in ticket template’ 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 - Staging Server