Create an account to edit articles | See Formatting Syntax for Wiki syntax | We look forward to your contribution!
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.
ProductCart v4
A login box in a store running ProductCart v4 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
%>
ProductCart v3
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?cmode=1 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"
Trace: • Selectable Items and Additional Charges • PayPal • ProductCart v3.51 Patch Guide • ProductCart v4.0 - Service Pack 4 (One Page Checkout Patch) • ProductCart v4.1 - Service Pack 1 • Installation: finding and uploading the ProductCart files • Generating a License for a Downloadable Product • How We Update a ProductCart-powered Store • Backing Up Your Store • Adding a login form to your store design