drchad Posted August 14, 2015 Share Posted August 14, 2015 Hi there, I was wondering if someone with more technical knowledge can help me out. I'd like to switch the following field in the address page: Please assign an address title for future reference. * I'd like to change it from a text input field to a checkbox field with two unchecked boxes, whereby the customer can only choose "home" or "business" (obviously not both). I was altering address.tpl in my theme but I couldn't quite get it working correctly so I was hoping someone with experience could share their knowledge. Thank you in advance! Link to comment Share on other sites More sharing options...
PhpMadman Posted August 17, 2015 Share Posted August 17, 2015 (edited) Completely untested. This should give the options Home and Business. With both label and value translatable. <!--<label for="alias">{l s='Please assign an address title for future reference.'} <sup>*</sup></label>--> <!--<input type="text" id="alias" class="is_required validate form-control" data-validate="{$address_validation.alias.validate}" name="alias" value="{if isset($smarty.post.alias)}{$smarty.post.alias}{elseif isset($address->alias)}{$address->alias|escape:'html':'UTF-8'}{elseif !$select_address}{l s='My address'}{/if}" />--> <span>{l s='Please assign an address title for future reference.'} <sup>*</sup></span> <label for="alias_home"> {l s='Home'}</label> <input type="radio" id="alias_home" class="is_required validate form-control" data-validate="{$address_validation.alias.validate}" name="alias" value="{l s='Home'}" /> <label for="alias_business"> {l s='Business'}</label> <input type="radio" id="alias_business" class="is_required validate form-control" data-validate="{$address_validation.alias.validate}" name="alias" value="{l s='Business'}" /> Edited August 17, 2015 by PhpMadman (see edit history) 1 Link to comment Share on other sites More sharing options...
drchad Posted August 18, 2015 Author Share Posted August 18, 2015 Awesome, this seems to be working! Thank you for your response, appreciate your help. Link to comment Share on other sites More sharing options...
PhpMadman Posted August 18, 2015 Share Posted August 18, 2015 Slightly more tested then the other code. Old code did not select Home / Business when modifying an address. Tested on English only, don't know if translated works. <!--<label for="alias">{l s='Please assign an address title for future reference.'} <sup>*</sup></label>--> <!--<input type="text" id="alias" class="is_required validate form-control" data-validate="{$address_validation.alias.validate}" name="alias" value="{if isset($smarty.post.alias)}{$smarty.post.alias}{elseif isset($address->alias)}{$address->alias|escape:'html':'UTF-8'}{elseif !$select_address}{l s='My address'}{/if}" />--> {if isset($smarty.post.alias)} {assign var="alias_var" value=$smarty.post.alias} {elseif isset($address->alias)} {assign var="alias_var" value={$address->alias|escape:'html':'UTF-8'[spam-filter] {/if} {assign var="alias_home" value={l s='Home'[spam-filter] {assign var="alias_business" value={l s='Business'[spam-filter] <span>{l s='Please assign an address title for future reference.'} <sup>*</sup></span><br> <label for="alias_home"> {l s='Home'}</label> <input type="radio" id="alias_home" class="is_required validate form-control" data-validate="{$address_validation.alias.validate}" name="alias" {if $alias_var == $alias_home} checked="checked" {/if} value="{l s='Home'}" /> <label for="alias_business"> {l s='Business'}</label> <input type="radio" id="alias_business" class="is_required validate form-control" data-validate="{$address_validation.alias.validate}" name="alias" {if $alias_var == $alias_business} checked="checked" {/if} value="{l s='Business'}" /> If modifying an old address, saved under an alternate name. Customer's might still save it without setting Home / Business Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now