USA_Webmaster Posted October 7, 2016 Share Posted October 7, 2016 /cart.php?a=checkout When customer is checkout page, they are prompted to select a default state. How do I set the default value dropdown for...say...state to be "Alaska"? theme = six orderforms = boxes Just thinking of some ways to make checkout flow 1 less click for customer. 0 Quote Link to comment Share on other sites More sharing options...
USA_Webmaster Posted October 8, 2016 Author Share Posted October 8, 2016 gentle nudge 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted October 8, 2016 Share Posted October 8, 2016 you can specify default state for any country by editing the following file: open this file for editing: /templates/orderforms/boxes/viewcart.tpl replace this line: <input type="text" name="state" id="inputState" value="{$clientsdetails.state}" class="form-control"{if $loggedin} disabled="disabled"{/if} /> with this line: <input type="text" name="state" id="inputState" value="{if $clientsdetails.state}{$clientsdetails.state}{else}{if $country=="US"}Alaska{/if}{/if}" class="form-control"{if $loggedin} disabled="disabled"{/if} /> replace Alaska with valid state name, the new line will display client choice if provided, or it will check if selected/default country is US so it will display Alaska as default option. you can add extra countries default selection like below: <input type="text" name="state" id="inputState" value="{if $clientsdetails.state}{$clientsdetails.state}{else}{if $country=="US"}Alaska{/if}{if $country=="GB"}Barnet{/if}{if $country=="FR"}Calvados{/if}{/if}" class="form-control"{if $loggedin} disabled="disabled"{/if} /> 1 Quote Link to comment Share on other sites More sharing options...
USA_Webmaster Posted October 8, 2016 Author Share Posted October 8, 2016 (edited) Marvelous! Thanks @sentq - works flawless! Hey, might you be able to point me into the right direction on howto remove confirm password input field from validation? Exclude it, so that customer doesn't need to type password twice. in the viewcart.tpl, there is some PHP code (around line #383) that looks like this: <div id="newPassword2" class="form-group has-feedback"> <label for="inputNewPassword2" class="col-sm-5 control-label">{$LANG.clientareaconfirmpassword}</label> <div class="col-sm-6 col-md-5"> <input type="password" name="password2" id="inputNewPassword2" value="{$password2}" class="form-control" /> <span class="form-control-feedback glyphicon"></span> <div id="inputNewPassword2Msg"> </div> </div> </div> p.s. - tried using this guys code, but for some reason it didn't work -- https://forum.whmcs.com/showthread.php?67554-Remove-Confirm-Password-on-Sign-Up&p=293183#post293183 -- i even tried adding ID to <form> and played around with it, like removed {literal} and also comparing the modern order form to boxes - no luck though Edited October 8, 2016 by USA_Webmaster forgot to explain myself more clearly 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted October 8, 2016 Share Posted October 8, 2016 first hide password confirm block by adding style="display:none;" to the main div containing this field: <div id="newPassword2" class="form-group has-feedback" style="display:none;"> now, copy this Javascript code inside the same file or inside checkout.js: $(document).ready(function() { $("#inputNewPassword1").on("keyup", function() { $("#inputNewPassword2").val($("#inputNewPassword1").val()); }); }); it will simply replicate what's in field 1 inside field 2 every time client is pressing keyboard keys 1 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.