How to Add a Login Form to Your Store Design

Last Updated: Dec 11, 2018 05:09PM EST

The customer login form

A login box is a simple form that gives existing customers a quick way to log into their account area. It typically contains a user name field, a password field, and a login link or button.

You can wrap a conditional statement around it so that it is only shown when a customer is not logged in.

A login box in a store running ProductCart should contain the following code:

<form name="myLoginForm" method="post" action="checkout.asp"> <input type="hidden" name="cmode" value="1"> <input type="hidden" name="PassWordExists" value="YES"> <input type="hidden" name="SubmitCO.y" value="1"> <h1>Account Login</h1> <p>E-mail: <input type="text" name="LoginEmail" value="" size="20"></p> <p>Password: <input type="password" name="LoginPassword" value="" size="20"></p> <p><a href="JavaScript:document.myLoginForm.submit();"><img src="images/login.gif"></a></p> </form>

Some customers have reported the following behavior:

  • When you try to login, the attempt is rejected
  • If you simply go back and try again with the same information, you can successfully log in

If this occurs, add the following code right before the login box code mentioned above:

<% if scSecurity=1 then Session("store_userlogin")="1" session("store_adminre")="1" end if %>

Showing and hiding the form

As mentioned above, you can use a conditional statement (an if statement) to show the login box/links or the account menu links. The conditional statement looks to see if a customer is logged in, as described here.

If a customer is not logged in, a link to register or log in is shown. If a customer is logged in, a few links to frequently used account management pages are shown instead.

Placing the form outside of ProductCart

Of course, this code could also be used on a page that is outside of ProductCart. There is no issue at all with doing so, since the form contains simple HTML and no dynamic content. The page can be anything: it does not have to be an ASP page. However, make sure to change the “action” so that it uses a correct path or URL to the checkout.asp page.

seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
Invalid characters found