Jump to content

Smarty Conditionals (does not contain)


Recommended Posts

Hi,

 

We are trying to customize our welcome emails depending on the product name of each customer. We need to send different content to the users that have a product name that doesn't contain a certain string/word.

 

We've managed to make it work when it contains a string {if $service_product_name|strstr:"WHATEVER"} but not when it does not contain a string.

 

We've tried {if $service_product_name is not "WHATEVER"} and {if $service_product_name % "WHATEVER"}, among other things, but they don't work (they give an error).

 

We asked the WHMCS support team but they don't know either.

 

Any clue?

 

Thanks!

Link to comment
Share on other sites

We are trying to customize our welcome emails depending on the product name of each customer. We need to send different content to the users that have a product name that doesn't contain a certain string/word.

We've managed to make it work when it contains a string {if $service_product_name|strstr:"WHATEVER"} but not when it does not contain a string.

We've tried {if $service_product_name is not "WHATEVER"} and {if $service_product_name % "WHATEVER"}, among other things, but they don't work (they give an error).

if it's a case of it either contains the string 'WHATEVER' or it doesn't, then it should be an IF ELSE...

{if $service_product_name|strstr:'WHATEVER'}do something{else}do something else{/if}

if you want to directly check a variable doesn't contain specific text...

{if !$service_product_name|strstr:'WHATEVER'}string does not contain WHATEVER{/if}

though i'd be inclined, where possible, to check for strings to exist and then use an else at the end if they don't.

 

We asked the WHMCS support team but they don't know either.

oh lord. :roll:

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