PixieChick Posted December 7, 2015 Share Posted December 7, 2015 Hi everyone, I'm trying to create an IF statement for the email template "invoice payment confirmation". If the customer has paid a domain renewal invoice I want the email to state that the domain has been renewed. If they have paid some other kind of invoice for a different service then I don't want it to say anything extra than the default email template which just confirms the invoice has been paid. Does anyone know how to create the IF statement required? Or is there another way for the system to send a domain renewal confirmation email? I found an email template for 'domain renewal successful' and also one for 'domain renewal confirmation' but these are not getting sent when a customer pays a domain renewal invoice. Any help would be greatly appreciated!! 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted December 7, 2015 Share Posted December 7, 2015 you could use ActionHook to query database and check if the invoice related to domain renewal or not and pass the value to email template to send 0 Quote Link to comment Share on other sites More sharing options...
PixieChick Posted December 7, 2015 Author Share Posted December 7, 2015 Hi sentq, thanks for your reply. Would you know how to write something like that - I don't have a clue! 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted December 8, 2015 Share Posted December 8, 2015 I'm trying to create an IF statement for the email template "invoice payment confirmation". If the customer has paid a domain renewal invoice I want the email to state that the domain has been renewed. If they have paid some other kind of invoice for a different service then I don't want it to say anything extra than the default email template which just confirms the invoice has been paid. something along the lines of the code below should work... Dear {$client_first_name}, {if $invoice_html_contents|strstr:'Domain Renewal'} The domain(s) below have been renewed. {$invoice_html_contents} {else} This is a payment receipt for Invoice {$invoice_num} sent on {$invoice_date_created} {$invoice_html_contents} Amount: {$invoice_last_payment_amount} Transaction #: {$invoice_last_payment_transid} Total Paid: {$invoice_amount_paid} Remaining Balance: {$invoice_balance} Status: {$invoice_status} {/if} You may review your invoice history at any time by logging in to your client area. Note: This email will serve as an official receipt for this payment. {$signature} you could run into an issue if the invoice contained both a domain renewal and another service renewal - as it would currently only show the domain renewal reply. also, the email will be triggered when payment is received, not when the domain is actually renewed - and for many reasons, the domain might not have been renewed at payment time (insufficient funds with registrar, WHMCS error, server issue etc). I found an email template for 'domain renewal successful' and also one for 'domain renewal confirmation' but these are not getting sent when a customer pays a domain renewal invoice. The "Domain Renewal Successful" is an admin email template, so only you would receive that and not the client; the "Domain Renewal Confirmation" is for the client and should be automatically sent if the TLD (.com, .net etc) is linked to a registrar in the domain pricing page, and the renewal was successful - it might also be sent if the domain renewal is manually triggered in the admin area, but I can't recall for certain either way. http://docs.whmcs.com/Domains_Management it might be worth investigating if/why the "Domain Renewal Confirmation" email isn't being sent (the email logs should show if it's being sent or not) - as sending that should be preferable than modifying the "Invoice Payment Confirmation" template. 0 Quote Link to comment Share on other sites More sharing options...
PixieChick Posted December 8, 2015 Author Share Posted December 8, 2015 Thanks brian! That was a very helpful reply I agree that sending the Domain Renewal Confirmation would be much better than modifying the payment confirmation email. The renewal confirmation email is definitely not being sent as I have checked the email logs. I can't find any automation settings for it so I'm not sure how to get it going. In the meantime I think I'll try adding the code you wrote to the payment confirmation email template. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted December 9, 2015 Share Posted December 9, 2015 I agree that sending the Domain Renewal Confirmation would be much better than modifying the payment confirmation email. The renewal confirmation email is definitely not being sent as I have checked the email logs. I can't find any automation settings for it so I'm not sure how to get it going. it might be a combination of the "Auto Renew" settings on the domain tab, and your registrar configuration. http://docs.whmcs.com/Domains_Tab#Auto_Renew_on_Payment Enabling will renew domains automatically at the registrar (eNom, ResellerClub etc) when the renewal invoice is paid. we have that enabled and the only times I can recall the DRC email not being sent is when there was an issue with renewing, e.g insufficient funds or expired domains with Nominet etc... perhaps it's an issue with your registrar setup, or some other misconfiguration - contacting support might help as they'd be able to take a closer look at your setup and determine why the email isn't triggering upon payment. 0 Quote Link to comment Share on other sites More sharing options...
PixieChick Posted December 9, 2015 Author Share Posted December 9, 2015 Thanks brian! I think you are right about the registrar configuration. The domains are set to Auto Renew but I think the domains haven't been assigned to a registrar module. When a client pays their domain invoice we manually renew the domain at the registrar and then manually mark the invoice as paid from the WHMCS admin area. I would have thought at this point the DRC email would be sent but it's not. I'll look into this further and may contact support like you suggest to get our setup checked. Thanks again for your help. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted December 10, 2015 Share Posted December 10, 2015 I think you are right about the registrar configuration. The domains are set to Auto Renew but I think the domains haven't been assigned to a registrar module. When a client pays their domain invoice we manually renew the domain at the registrar and then manually mark the invoice as paid from the WHMCS admin area. I would have thought at this point the DRC email would be sent but it's not. WHMCS wouldn't know whether the domain has been renewed or not - only that it's been paid... so it only sends out the Invoice Paid Confirmation. if the domain was linked to a registrar and you marked it as paid, it would first send the Invoice Paid email to the client; then connect to the registrar and try to renew; if successful, it will then send out the "Domain Renewed" email to the client - if renewal failed, the admin would receive a "Domain Renewal Failed" email. 0 Quote Link to comment Share on other sites More sharing options...
PixieChick Posted December 10, 2015 Author Share Posted December 10, 2015 Ok thanks brian, I'll adjust our settings accordingly. 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.