Jump to content

Conditional string in order conformation email


ufshane

Recommended Posts

It it possible to do use {$service_product_name} or even better the product ID in a conditional string in the order conformation email?

 

For example:

 

{if $service_product_name eq "Product name"} (or if we can use a string for product id instead)

text for product 1

{else $service_product_name eq "Product name 2"}

text for product 2

{else $service_product_name eq "Product name 3"}

text for product 3

{/if}

 

Is the above example doable specifically in the order confirmation email

Link to comment
Share on other sites

I don't believe that it is, I think you can only include the merge fields shown in the box at the bottom of the email template page.

 

http://docs.whmcs.com/Email_Templates#Conditional_Displays

 

if you could, then the code would be....

{if $service_product_name eq "Product name"}

text for product 1

{elseif $service_product_name eq "Product name 2"}

text for product 2

{elseif $service_product_name eq "Product name 3"}

text for product 3

{/if}

you could use this code in any of the welcome emails though... $service_id should work too - with the advantage being that if you ever renamed your products, the email templates wouldn't be affected.

Link to comment
Share on other sites

i'm wondering if you can do it by searching {$order_details} instead - its output should effectively display the value of $service_product_name...

 

{if $order_details|strstr:"Product name"}

text for product 1

{if}

 

if an order has one product, then this should work fine - if it contains multiple items and you are using specific text for each, then it could get messy... that's why it's easier to use the welcome emails!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated