Jump to content

Default country error in v6


Eduardo G.

Recommended Posts

Hi,

 

Hi! Even if I set a default country in admin area (Setup > Localisation), when a client signs up directly (register.php), the default country selected is United States.

I think this is a bug.

I think this is one of those weird WHMCS situations that floats somewhere between being a bug and a feature request. :roll:

 

i've just had a look at the v6 template code, and it's intentionally coded to default to the United States...

 

                <div class="form-group">
                   <label for="country" class="control-label">{$LANG.clientareacountry}</label>
                   <select id="country" name="country" class="form-control">
                       {foreach from=$clientcountries key=thisCountryCode item=thisCountryName}
                           <option value="{$thisCountryCode}" {if $thisCountryCode eq "US"}selected="selected"{/if}>{$thisCountryName}</option>
                       {/foreach}
                   </select>
               </div>

so the argument against it being a real bug is that you can easily go into the template (clientregister.tpl) and replace "US" in the {if} statement with your country code, e.g "GB" for United Kingdom - v5.3 doesn't specify any country as default, it just lists them in the country dropdown starting with Afghanistan... you could make v6 do the same by removing the {if} statement from the above code...

 

{if $thisCountryCode eq "US"}selected="selected"{/if}

 

When client registers from cart, during an order, it works fine.

the reason why it works in the order forms, but doesn't in register.php is because the default country value is passed to two Smarty variables in the order form, but isn't passed at all in the registration form - if the value was passed, then you could make the default country choice automatic on the registration page... :)

 

so perhaps that's a bug, an oversight or by intentional design - the only way to determine that would be to post this as a Bug Report (with a link back to this thread) and let WHMCS Nate (or one of his colleagues) ponder on it.

 

so short-term solution would be to modify your clientregister.tpl template and change "US" to your preferred country code.

 

you could make an action hook that would create a Smarty variable to pull the default country code from the database and then use that in the registration form, but it would probably be quicker for now to just modify the template with the preferred country code.

 

if you report it as a bug, and WHMCS see it as such, they may make the default country code variable available to the registration template and modify the {if} statement accordingly.

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