Jump to content

E-mail template condition syntax?


postcd

Recommended Posts

Hello dear readers,

 

when i add following condition to the "product" e-mail template (new product delivery e-mail):

 

{if $service_product_name eq "VPS"}You ordered a VPS{else}{/if}

 

then i see blank page when i attempt to send such e-mail. When i remove condition, sending works.

 

The product name is "128 VPS". I want to show message if product name contains (not equal) the word: VPS

My target is to show message only to ones who ordered product from group: Virtual servers (VPS)".

 

I Googled and read WHMCS documentation and nothing.

 

My idea around that was to define some variable based on the fact the ordered product is example VPS.

 

Currently i have following in /templates/orderforms/verticalsteps/configureproduct.tpl , inside {if $productinfo.type eq "server"}

 

<input type="hidden" name="ns1prefix" size="10" value="ns1" />

<input type="hidden" name="ns2prefix" size="10" value="ns2" />

 

in same tpl file are variables:

{$productinfo.groupname}

{$productinfo.name}

 

so can i:

 

{if $productinfo.type eq "server"}

...

<input type="hidden" name="ns1prefix" size="10" value="{if $productinfo.groupname eq "Virtual servers (VPS)"}ns1vps{else}ns1{/if}" />

<input type="hidden" name="ns2prefix" size="10" value="{if $productinfo.groupname eq "Virtual servers (VPS)"}ns2vps{else}ns2{/if}" />

...

{/if}

 

and based on that in e-mail template i will be able to use: {if $service_ns1 eq "ns1vps"}You ordered a VPS{else}{/if}

is that correct? or there is better way?

 

UPDATE: my way described above worked (allowed me to show certain text in the product welcome e-mail in case that product belong to the certain product category) PS: there is no easier way?

Edited by postcd
Link to comment
Share on other sites

when i add following condition to the "product" e-mail template (new product delivery e-mail):

then i see blank page when i attempt to send such e-mail. When i remove condition, sending works.

I don't see the point of the {else} in that condition. :?:

 

The product name is "128 VPS". I want to show message if product name contains (not equal) the word: VPS

My target is to show message only to ones who ordered product from group: Virtual servers (VPS)".

My idea around that was to define some variable based on the fact the ordered product is example VPS.

Currently i have following in /templates/orderforms/verticalsteps/configureproduct.tpl , inside {if $productinfo.type eq "server"}

...

and based on that in e-mail template i will be able to use: {if $service_ns1 eq "ns1vps"}You ordered a VPS{else}{/if}

is that correct? or there is better way?

no no no - never take a Smarty variable from one template and assume it will work in another... and especially don't try to use it in an email template!

 

all you should need to do is use...

 

{if $service_product_name|strstr:"VPS"}You ordered a VPS{/if}

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