Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Hiding/showing Username & Password area

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #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
  #2  
Old 10-22-2008, 04:45 AM
  JWait's Avatar 
JWait JWait is offline
 

X-Man
  
Join Date: Nov 2005
Location: California
Posts: 2,440
 

Default Re: Hiding/showing Username & Password area

Just out of curiosity how do you keep track of your customers and their orders?

While consumers may or may not want to create an account, x-cart will create one anyway. It is called "anonymous checkout". Generally, even if a customer only places 1 order they want to know the status of that order (I do anyway), and your method does not provide that, other than any emails that are sent. Also, hiding the "shipping address" section does not allow your customer to have the order sent to anywhere except the billing address. Maybe you only want to do it this way, but it doesn't allow the customer any option.

I think a better option would be to hide the "register" button but display "login" on your main page and simply allow "anonymous checkout" for those customers that do not want to create a account. You can also choose "moderated membership" in admin so that resellers can apply for "wholesale" membership.

To answer your original question, you could enclose the username and password section of the register page in a "if" statement checking if there was something in the cart, and if there is not display the username and password fields. As I said, I wouldn't do this.
__________________
Two Separate X-Cart Stores
Version 4.4.4 Gold - X-AOM - Vivid Dreams Aquamarine (modified) - Linux
Mods - Newest Products - View All -, and a few others. Numerous upgrades from 4.0.x series.
Integrated with Stone Edge Order Manager + POS

Version 4.1.12 Gold (fresh install) - X-AOM - Linux
Mods - XCSEO free
Reply With Quote
  #3  
Old 10-22-2008, 05:20 AM
 
retrtrtrytrutru retrtrtrytrutru is offline
 

Senior Member
  
Join Date: Aug 2007
Posts: 101
 

Default Re: Hiding/showing Username & Password area

I think I didn't explain it well enough, sorry. By default X-Cart hides the Shipping Address area on the register page, but of course the customer can still use it by clicking on the option to ship to a different address. This will show the area to the customer. I did the same with the Username and Password area so that the registration page would be as simple as possible. See www.qualitylamps.eu/register.php

Note: this page is the actual and live registration page of our website. When someone uses this link I want to checkbox for "Create an account?" to be enabled by default. But the same page is also used during the checkout process, here I want to keep this area hidden because most customers do not want an account. They want a new projector lamp and don't want to be bothered by usernames and passwords.
__________________
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
  #4  
Old 10-22-2008, 06:21 AM
  JWait's Avatar 
JWait JWait is offline
 

X-Man
  
Join Date: Nov 2005
Location: California
Posts: 2,440
 

Default Re: Hiding/showing Username & Password area

I'm not sure what it is you are trying to do. You have a "Your Account" box which appears on almost every page on your site, which seems to defeat what you say you are trying to do. If you moved this and simply used a button that said "login" which you could place almost anywhere (I would put it in the header under you language "bubbles") and have it link to a "Your Account" section displayed in the main part (center) of your page. You could also have "login" change to "logout" once a customer has logged in, or even say "Your Account" and take them to a page (again, in the center area) that allows them to modify or delete their account, and check order history (all default x-cart options).

I don't think "create account" should be enabled by default, but here is the code to do the same thing for newsletter subscription, just use the same logic for your checkbox'...

FIND:
<td><input type="checkbox" name="subscription[{$listid}]" {if $subscription[$listid] ne ""}checked />{/if}</td>

REPLACE WITH:
<td><input type="checkbox" name="subscription[{$listid}]" {if $subscription[$listid] ne ""}{/if}checked /></td>

I moved the closing {/if} to BEFORE the checked. This preserves the logic... and auto-checks the box for new registrants and maintains the status for existing.

the ONLY downside that I see here is that if the customer modifies their profile, and the user had previously unchecked the box on the modify profile page, it will now be checked... nudge, nudge... "please sign up for our newsletter".

Also, I would change the text "The form below allows you to create a profile which is necessary to place orders. Do not forget that this information is essential to use our services correctly." to something that doesn't say "create a profile", maybe something like "The following information is necessary to process and ship your order..", in fact I usually avoid the term "profile" altogether, replacing it with "account" wherever it occurs.
__________________
Two Separate X-Cart Stores
Version 4.4.4 Gold - X-AOM - Vivid Dreams Aquamarine (modified) - Linux
Mods - Newest Products - View All -, and a few others. Numerous upgrades from 4.0.x series.
Integrated with Stone Edge Order Manager + POS

Version 4.1.12 Gold (fresh install) - X-AOM - Linux
Mods - XCSEO free
Reply With Quote
  #5  
Old 10-22-2008, 06:54 AM
 
retrtrtrytrutru retrtrtrytrutru is offline
 

Senior Member
  
Join Date: Aug 2007
Posts: 101
 

Default Re: Hiding/showing Username & Password area

Thanks for thinking with me on this JWait. The "problem" we have is that we are contacted by a lot of companies that want to resell our products besides our usual one-time-purchase customers. Whenever someone contacts us and wants to become a reseller the first thing we ask them to do is to register a new account. So the "Register new account" option should always be visible on the website so I put it in the MyAccount box on our website because existing customers will login there as well to see their special prices.

So, on the main page a new customer who wants an account can click on the link and fill in his details. But, the problem is that on the register.php page the fields for username and password are now hidden by default. This is the result of the changes I made to hide these fields during a normal checkout routine (cart.php?mode=checkout) because then one-time-purchase consumers can just go through the checkout process without even seeing the fields (they can choose to show the fields if they want and setup an account anyway of course).

Another issue we have is that the MyAccount box is something our old customers are used to since we had another shop before this one and it has the same placing of the login. As far as the text goes I will have a look at it but it's not that important for now.

This picture should sum up what I am trying to achieve, maybe I should have posted this right away


http://www.qualitylamps.eu/skin1/img/tmp_register.gif
__________________
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
  #6  
Old 10-22-2008, 03:11 PM
  JWait's Avatar 
JWait JWait is offline
 

X-Man
  
Join Date: Nov 2005
Location: California
Posts: 2,440
 

Default Re: Hiding/showing Username & Password area

Well, since one page is cart.php?mode=checkout and the other is register.php, maybe you can use an "if" statement like

{if mode ne "checkout"}
<input type="checkbox" name="subscription[{$listid}]" {if $subscription[$listid] ne ""}{/if}checked />
{/if}

I'm not sure of the syntax (mode might be $mode, or something else), and again used the newsletter subscription, but that might work. The problem is, it looks like you are using a 3rd party mod, an I don't have the template to look at.
__________________
Two Separate X-Cart Stores
Version 4.4.4 Gold - X-AOM - Vivid Dreams Aquamarine (modified) - Linux
Mods - Newest Products - View All -, and a few others. Numerous upgrades from 4.0.x series.
Integrated with Stone Edge Order Manager + POS

Version 4.1.12 Gold (fresh install) - X-AOM - Linux
Mods - XCSEO free
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 05:55 AM.

   

 
X-Cart forums © 2001-2020