WordPress.org

Ready to get started?Download WordPress

Forums

Events Manager
conditional placeholder for mails (1 post)

  1. Antoine
    Member
    Posted 3 years ago #

    Hi all,

    First, sorry for my english, i'll try to do my best to make myself as clear as possible.

    My problem: I'd like to add a conditional "reminder" in the mails EM sends, regarding the total amount one have to pay after booking.

    I found how to display the total amount (adding '#_BOOKINGPRICE' => $this->price, to em-booking.php) but I realized that some events may be free or that one may offer free tickets for his event. I don't want EM to send an email with "Price: 0 EUR" but instead something like "It's free!" (or nothing)

    I think I have to create a conditional placeholder, like {the_amount} - I tried hard but can't succeed in doing it. I looked the "Creating Conditional Placeholders" tutorial, but I hardly understand how it works. Instead I tried to copy existing ones in order to have a proper idea on how it works, it gives me this:

    if ($condition == 'the_amount') {
    if($this->price > 0){
    $replacement = substr($conditionals[0][$key], 14, strlen($conditionals[0][$key])-29); //29 = (15+14)
    }else{
    $replacement = 'Free!';
    }
    }

    I added to my mails:

    {the_amount}
    - Price: #_BOOKINGPRICE EUR
    {/the_amount}

    but it always displays "Free!" text. I think "$this->price > 0" is not correct and I tried many other things - in vain...

    Does anyone have an idea?

    Many thanks

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic