setting default country in /templates/signup.html

Discussion in 'Customization & add-ons' started by kel, Oct 20, 2009.

  1. kel

    kel aMember Pro Customer

    Joined:
    May 20, 2004
    Messages:
    16
    Hi there, we only do business in one country. I've edited the country list so that only one shows up in the signup form, but customers still have to select "Canada".

    How can I modify either signup.php or /templates/signup.html so that it automatically defaults to one country? I am sure this would affect the next field "State" too since the drop-down menu changes based on which country is select.

    thanks,
    Kelly
  2. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    Edit /amember/templates/signup.html and replace this:
    Code:
        <select name="country" id="f_country" size="1" >
        {country_options selected=$smarty.request.country}
        </select>
    
    to
    Code:
        <select name="country" id="f_country" size="1" >
    <option value='CA'>Canada
        </select>
    
  3. erwinvdb

    erwinvdb aMember Pro Customer

    Joined:
    Aug 30, 2007
    Messages:
    264
    Any suggestion how to set a default country while still having the full country list?
  4. erwinvdb

    erwinvdb aMember Pro Customer

    Joined:
    Aug 30, 2007
    Messages:
    264
    Andrey was so kind to send me the answer:
    Where <country code> should be replaced with your code of choice, for example NL for Netherlands, UK for United Kingdom.
  5. vacc_webmaster

    vacc_webmaster Member

    Joined:
    Jan 24, 2007
    Messages:
    51
    Thanks for the information. That helped set the default country. How would it be done to set the state by default in the drop-down to Virginia?

    Code:
    <tr>
        <th><b><label for="state">#_TPL_SIGNUP_STATE#{$a_req}</label></b><br />
        <div class="small"></div></th>
        <td>
        <input type="text" name="state" id="t_state" size="30"
            {if $config.use_address_info eq '1'}_required="1" realname="State"
            {else}_required="0"{/if}
            value="{$smarty.request.state|escape}"
            {if count($state_options)>1}disabled="true" style='display: none;' {/if}
            />
        <select name="state" id="f_state" size="1"
            {if $config.use_address_info eq '1'}_required="1" realname="State"{/if}
            {if count($state_options)<=1}disabled="true" style='display: none;'{/if}
            >        
        {html_options options=$state_options selected=$smarty.request.state}
        </select>
        </td>
    </tr>
  6. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    You can do this the same way:
    Code:
    {if $smarty.request.state}
        {html_options options=$state_options selected=$smarty.request.state}
    {else}
        {html_options options=$state_options selected='VA'}
    {/if}
    
  7. itoben

    itoben New Member

    Joined:
    Jan 13, 2012
    Messages:
    7
    Hello,

    And version aMember 4.1.10, how it's done?

    I want France by default.

    Thanks.
  8. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    this will be available in next aMember version. Added default country option to address info brick settings.
  9. itoben

    itoben New Member

    Joined:
    Jan 13, 2012
    Messages:
    7
    Ok thanks.

    I look forward to the new version.
  10. bennyuk1

    bennyuk1 aMember Pro Customer

    Joined:
    Jan 12, 2012
    Messages:
    200
    I also would bekeen to get rid of US and CA appearing at the top of country drop downs and be able to change it UK
  11. stevenjohn

    stevenjohn Member

    Joined:
    Nov 9, 2006
    Messages:
    40
    Easy - update the value of 'tag' in table in am_country :)

Share This Page