View Single Post
  #1  
Old 10-21-2008, 11:04 PM
 
retrtrtrytrutru retrtrtrytrutru is offline
 

Senior Member
  
Join Date: Aug 2007
Posts: 101
 

Default Hiding/showing Username & Password area

Hi everyone,

We have the following situation:

We sell products to consumers as well as resellers. Consumers don't like to create accounts when buying something as they usually will only buy with us once (we replacement goods that will last around 2 years) but resellers will buy more often so they have to create an account with us.

What I have done to make it easy for consumers to buy is to hide the Username & Password area during the checkout process. But, on the mainpage we do have a like to register.php so resellers can setup an account directly. When someone clicks on this link and is taken to register.php the Username & Password area is also hidden while the username and password fields are now mandatory. How can I make sure that on the register.php page the area is shown by default and it stays hidden during the normal checkout process?

For your reference here is my current main/register_account.tpl file, I edited it with the same code that is used for hiding the Shipping Address area:

Code:
{* $Id: register_account.tpl,v 1.19.2.5 2006/12/25 13:32:08 max Exp $ *} {* AANGEPAST 20080922, indien deze IF verwijderd wordt dan word het veld standaard wel getoond *} {if $is_areas.S eq 'Y'} {* EINDE AANGEPAST 20080922 *} {if $hide_account_section ne "Y"} {if $hide_header eq ""} {* AANGEPAST 20080922 *} <tr> <td height="20" colspan="3"> <script type="text/javascript"> <!-- {literal} function RegAccountOpen() { var obj = document.getElementById('RegAccount'); var box = document.getElementById('reg_box'); if (!obj || !box) return; box.style.display = obj.checked ? "" : "none"; } {/literal} --> </script> <br /> <table cellpadding="0" cellspacing="0"> <tr> <td><label for="RegAccount" class="RegSectionTitle"><b>{$lng.lbl_username_n_password}</b></label></td> <td>&nbsp;</td> <td><input type="checkbox" id="RegAccount" name="RegAccount" value="Y" onclick="javascript: RegAccountOpen();"{if $RegAccount} checked="checked"{/if} /></td> </tr> </table> <hr size="1" noshade="noshade" /> </td> </tr> {* EINDE AANGEPAST 20080922 *} {* ORIGINEEL uitgezet <tr> <td colspan="3" class="RegSectionTitle"><b>{$lng.lbl_username_n_password}</b><hr size="1" noshade="noshade" /></td> </tr> *} {/if} {* AANGEPAST 20080922 *} <tbody id="reg_box"> {* EINDE AANGEPAST 20080922 *} {if $anonymous ne "" and $config.General.disable_anonymous_checkout ne "Y"} {* Anonymous account *} <tr> <td colspan="3">{$lng.txt_anonymous_account_msg}</td> </tr> {/if} {if $userinfo.login eq $login and $login and $userinfo.usertype ne "C"} {* Display membership level *} <tr style="display: none;"> <td> <input type="hidden" name="membershipid" value="{$userinfo.membershipid}" /> <input type="hidden" name="pending_membershipid" value="{$userinfo.pending_membershipid}" /> </td> </tr> {else} {if $config.General.membership_signup eq "Y" and ($usertype eq "C" or ($active_modules.Simple_Mode ne "" and $usertype eq "P") or $usertype eq "A" or $usertype eq "B") && $membership_levels} {include file="admin/main/membership_signup.tpl"} {/if} {if $usertype eq "A" or ($usertype eq "P" and $active_modules.Simple_Mode ne "") && $membership_levels} {include file="admin/main/membership.tpl"} {/if} {* /Display membership level *} {/if} {if $anonymous ne "" and $config.General.disable_anonymous_checkout ne "Y"} {* Anonymous account *} <tr> <td align="right" nowrap="nowrap">{$lng.lbl_username}</td> <td>&nbsp;</td> <td nowrap="nowrap"> <input type="text" id="uname" name="uname" size="32" maxlength="32" value="{if $userinfo.uname}{$userinfo.uname}{else}{$userinfo.login}{/if}" onFocus="this.className='selected';" onblur="this.className='';" /> {if ($reg_error ne "" && $reg_error ne 'A' && $userinfo.uname eq "" && $userinfo.login eq "") || $reg_error eq "U"}<font class="Star">&lt;&lt;</font>{/if} </td> </tr> <tr> <td align="right" nowrap="nowrap">{$lng.lbl_password}</td> <td>&nbsp;</td> <td nowrap="nowrap"><input type="password" name="passwd1" size="32" maxlength="64" value="{$userinfo.passwd1}" onFocus="this.className='selected';" onblur="this.className='';" /> </td> </tr> <tr> <td align="right" nowrap="nowrap">{$lng.lbl_confirm_password}</td> <td>&nbsp;</td> <td nowrap="nowrap"><input type="password" name="passwd2" size="32" maxlength="64" value="{$userinfo.passwd2}" onFocus="this.className='selected';" onblur="this.className='';" /> </td> </tr> {* /Anonymous account *} {else} {* NOT anonymous account *} <tr> <td align="right" nowrap="nowrap">{$lng.lbl_username}</td> <td class="Star">*</td> <td nowrap="nowrap"> {if $userinfo.login ne "" || ($login eq $userinfo.uname && $login ne '')} <b>{$userinfo.login|default:$userinfo.uname}</b> <input type="hidden" name="uname" value="{$userinfo.login|default:$userinfo.uname}" /> {else} <input type="text" id="uname" name="uname" size="32" maxlength="32" value="{if $userinfo.uname}{$userinfo.uname}{else}{$userinfo.login}{/if}" onFocus="this.className='selected';" onblur="this.className='';" /> {if ($reg_error ne "" and $userinfo.uname eq "" and $userinfo.login eq "") or $reg_error eq "U"}<font class="Star">&lt;&lt;</font>{/if} {/if} </td> </tr> <tr> <td align="right" nowrap="nowrap">{$lng.lbl_password}</td> <td><font class="Star">*</font></td> <td nowrap="nowrap"><input type="password" id="passwd1" name="passwd1" size="32" maxlength="64" value="{$userinfo.passwd1}" onFocus="this.className='selected';" onblur="this.className='';" /> {if $reg_error ne "" and $userinfo.passwd1 eq ""}<font class="Star">&lt;&lt;</font>{/if} </td> </tr> <tr> <td align="right" nowrap="nowrap">{$lng.lbl_confirm_password}</td> <td class="Star">*</td> <td nowrap="nowrap"><input type="password" id="passwd2" name="passwd2" size="32" maxlength="64" value="{$userinfo.passwd2}" onFocus="this.className='selected';" onblur="this.className='';" /> {if $reg_error ne "" and $userinfo.passwd2 eq ""}<font class="Star">&lt;&lt;</font>{/if} </td> </tr> {* / NOT anonymous account *} {/if} {if (($active_modules.Simple_Mode ne "" and $usertype eq "P") or $usertype eq "A") and ($userinfo.uname && $userinfo.uname ne $login or !$userinfo.uname and $userinfo.login ne $login)} {if $userinfo.status ne "A"}{* only for non-anonymous users *} <tr valign="middle"> <td align="right">{$lng.lbl_account_status}:</td> <td>&nbsp;</td> <td nowrap="nowrap"> <select name="status"> <option value="N"{if $userinfo.status eq "N"} selected="selected"{/if}>{$lng.lbl_account_status_suspended}</option> <option value="Y"{if $userinfo.status eq "Y"} selected="selected"{/if}>{$lng.lbl_account_status_enabled}</option> {if $active_modules.XAffiliate ne "" and ($userinfo.usertype eq "B" or $smarty.get.usertype eq "B")} <option value="Q"{if $userinfo.status eq "Q"} selected="selected"{/if}>{$lng.lbl_account_status_not_approved}</option> <option value="D"{if $userinfo.status eq "D"} selected="selected"{/if}>{$lng.lbl_account_status_declined}</option> {/if} </select> </td> </tr> {if $display_activity_box eq "Y"} <tr valign="middle"> <td align="right">{$lng.lbl_account_activity}:</td> <td>&nbsp;</td> <td nowrap="nowrap"> <select name="activity"> <option value="Y"{if $userinfo.activity eq "Y"} selected="selected"{/if}>{$lng.lbl_account_activity_enabled}</option> <option value="N"{if $userinfo.activity eq "N"} selected="selected"{/if}>{$lng.lbl_account_activity_disabled}</option> </select> </td> </tr> {/if} {/if}{* $userinfo.status ne "A" *} <tr valign="middle"> <td colspan="2">&nbsp;</td> <td nowrap="nowrap"> <table> <tr> <td><input type="checkbox" id="change_password" name="change_password" value="Y"{if $userinfo.change_password eq "Y"} checked="checked"{/if} /></td> <td><label for="change_password">{$lng.lbl_reg_chpass}</label></td> </tr> </table> </td> </tr> {/if} {else} <tr style="display: none;"> <td> <input type="hidden" name="uname" value="{$userinfo.login|default:$userinfo.uname}" /> <input type="hidden" name="passwd1" value="{$userinfo.passwd1}" /> <input type="hidden" name="passwd2" value="{$userinfo.passwd2}" /> </td> </tr> {* AANGEPAST 20080922 *} {/if} {if !$RegAccount} <tr style="display: none;"> <td> <script type="text/javascript"> <!-- if (document.getElementById('reg_box')) document.getElementById('reg_box').style.display = 'none'; --> </script> </td> </tr> {/if} </tbody> {* EINDE AANGEPAST 20080922 *} {/if}

Thanks for the help!
__________________
www.qualitylamps.eu
X-Cart Gold 4.1.8, PHP 5.2.6, MySQL 5.0.51a, Apache 2.2.9

www.vervangjelamp.nl
X-Cart Gold 4.2.0, PHP 5.2.6, MySQL 5.0.37-standard, Apache/2

Sorry for the weird user name, I registered it by mistake
Reply With Quote