WHMCS: how to check the cart for an AU domain?

43 Views Asked by At

I'd like to add a message to the configure domains screen to check if any AU domains have been added to the cart, and if so, advise the customer they need an Australian Business Number to buy the domain.

I believe I need to check the $domains array, but I can't find any mention of this array at https://developers.whmcs.com

What code would I need to add to my configure-domains.tpl file to check for an AU domain in the cart and display a message?

1

There are 1 best solutions below

0
M. Haseeb Akhtar On

You can do it easily in the $domains loop in your configuredomains.tpl by exploding the domain name by . and check if the extension is au, then show custom message, like this:

{foreach $domains as $num => $domain}
    {assign var=extention value="."|explode:$domain.domain}

    {if isset($extention[1]) && $extention[1] == 'au'}
        <div class="alert alert-info" role="alert">
            <p>Since you have added an "au" domain, you need an Australian Business Number to buy the domain.</p>
        </div>
    {/if}

Instead of adding a static text here, you can add translated text in the lang files and print it here like:

<p>{$LANG.aucartmsg}</p>