You are here: The ProductCart Encyclopedia » How To's » Adding a login form to your store design
Adding a login form to your store design
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 v3 should contain the following code:
<form name="login" method="post" action="checkout.asp?cmode=1"> User Name <input type="text" name="LoginEmail"> Password <input type="password" name="LoginPassword"> <input name="PassWordExists" type="hidden" value="YES" > <a href="JavaScript:document.login.submit();"><img src="images/login.gif"></a> <input type="hidden" name="SubmitCO.y" value="1"> </form>
Notes for v2.x users
If you are upgrading from a previous version of ProductCart, please note the following changes compared to the code that is currently on your page (if any):
- PassWordExists is a new field and needs to be passed with a value of YES
- The login form should point to checkout.asp?cmode1 instead of custva.asp
- The field names are now LoginEmail and LoginPassword instead of email and password.
- The SubmitCO.y field should remain the same.
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.
Here is an example that targets one of our demo stores on the Early Impact Web site.
action="http://www.earlyimpact.com/demos/standard/pc/checkout.asp?cmode=1"