postcd Posted March 10, 2017 Share Posted March 10, 2017 (edited) 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 March 10, 2017 by postcd 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted March 10, 2017 Share Posted March 10, 2017 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: VPSMy 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} 1 Quote Link to comment Share on other sites More sharing options...
postcd Posted March 10, 2017 Author Share Posted March 10, 2017 Thank you, your simple code worked. Now i can show text based on product name. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.