dippa Posted February 17, 2015 Share Posted February 17, 2015 Hi, for overdue email templates, I would like a suspension notice to appear, but only if the overdue invoice is for a hosting product. For custom invoices I don't want a suspension notice to appear. I have tried using some 'if' statements but I'm not sure which variable I should be checking. So what I need in the email template is something along the lines of: {if $product_type eq "Hosting"} Your hosting will be suspended in 7 days {/if} 0 Quote Link to comment Share on other sites More sharing options...
durangod Posted February 18, 2015 Share Posted February 18, 2015 (edited) I think you can set suspension per product in the product setup pages. Wait so you want the text on the overdue email itself, right? Not a new termination letter? Edited February 18, 2015 by durangod 0 Quote Link to comment Share on other sites More sharing options...
dippa Posted February 18, 2015 Author Share Posted February 18, 2015 Wait so you want the text on the overdue email itself, right? Not a new termination letter? Yes that is correct, I would like to be able to write the text on the overdue email itself. But needs to be for hosting products only. Some overdue invoices wouldn't make sense to have a suspension notice on it, such as custom invoices. So what conditional do I need to write to do that? Thanks 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted February 18, 2015 Share Posted February 18, 2015 So what conditional do I need to write to do that? there isn't a guaranteed simple way to do this in the invoice email templates where you don't have direct access to the product info... if your hosting product's names contains strings you can search for (the obvious ones being if the product name contains "Hosting" or "Account", then you could search the $invoice_items array for these words and if found using it as a trigger to add a suspension warning... though there is always the risk of errors (e.g if someone has ordered a domain containing that keyword). if they don't, then you'd probably be looking at writing an action hook to query the invoices database table to detect the product type. 0 Quote Link to comment Share on other sites More sharing options...
dippa Posted February 19, 2015 Author Share Posted February 19, 2015 Thank you, can you please show me how to write an example conditional using $invoice_items 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted February 19, 2015 Share Posted February 19, 2015 Thank you, can you please show me how to write an example conditional using $invoice_items it turns out that there is a guaranteed simple way using $invoice_items ! {foreach key=num item=invoiceitem from=$invoice_items} {if $invoiceitem.type eq "Hosting"}Your hosting account will be suspended in 7 days{break}{/if} {/foreach} this loops through the invoiceitems array... if it finds a product type of "Hosting", it adds the suspension text to the email and stops the loop - if it's a domain/addon/custom etc, it doesn't add anything. i've added the {break} so that it only displays the suspension message once - if you remove it, and if the invoice has two or more hosting accounts, it would display the message multiple times... if you could add the specific domain to the suspension message that would be useful, but there's no easy way to get it (other than perhaps by regex-ing the description field or querying the db)... hopefully, it's something that you won't need to do! 0 Quote Link to comment Share on other sites More sharing options...
dippa Posted February 19, 2015 Author Share Posted February 19, 2015 Brilliant, thanks brian!!! 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.