Announcement:Materials and articles for ProductCart 5 can be found at our brand new support center.

Create an account to edit articles | See Formatting Syntax for Wiki syntax | We look forward to your contribution!

Understanding login.asp

The file “login.asp”, located in the “pc” folder, is a complex, but extremely useful file in ProductCart. It consolidates a number of tasks into one set of code. This page can help you understand the various tasks it performs, in case you need to edit it.

Make sure to read our Guidelines for editing ProductCart's source code before you make any changes.

This article applies to version ProductCart version 3.x. It does not apply to ProductCart v4.x where the checkout system was substantially modified.

Do not use any links to login.asp in ProductCart v4. This article is for ProductCart v3 only. The link to registering a new customer in v4 - outside of “One Page Checkout” is: “pc/Checkout.asp?cmode=1”

Checking out

There are three checkout scenarios: a new customer, a new customer that does not want to create a password, and an existing customer. In all three cases the pages that are loaded are:

  • checkout.asp (no query string)
  • login.asp?lmode=0
    Note the lmode query string value, which equals “0” in this case. If you need to edit login.asp this one piece of information can help you isolate sections of the code that pertain to the scenario that you are editing, as IF statements based on the lmode querystring divide the code.

The field “PassWordExists” (radio buttons on checkout.asp) is passed to login.asp with the value

  1. “YES” for a customer that is logging in
  2. “NO” for a new customer that is registering
  3. “NOREG” when the customer opts to register without creating a password.

Registering outside of checkout

Customers might wish to register with your store outside of the checkout process. When this happens, the pages that are loaded are:

  • Checkout.asp?cmode=1
    This is the page that you can link to if you want to have a “Register” link on your Web store. If you'd rather link to the customer account's home page, then use custpref.asp in your link.
  • login.asp?lmode=2
    Note the lmode query string value, which equals “2” in this case.

Modifying personal information

When a customer logs into his/her account to edit his account information (billing address, newsletter preferences, custom field values - if any), the pages loaded are:

  • Checkout.asp?cmode=1
    If you link to custpref.asp (customer account home page) and the customer is not logged in, this is the page that you are redirected to. Note the querystring value.
  • checkout.asp?cmode=2&fmode=1
    If the customer does not remember his/her password, they are redirected to a different section of code on the same checkout.asp page.
  • custpref.asp
    The customer account home page.
  • login.asp?lmode=1
    The version of login.asp that is loaded to allow the customer to edit his/her account details. Note the “lmode” query string value, which equals “1” in this case.

Changing the way a customer account is setup

Among other things, login.asp is also the page that handles the creation of the new customer account in the ProductCart storefront. Do a source code search for…

query="INSERT INTO customers

… and you will see the area of the page where customer data is inserted into the database. This means that login.asp is the page that you will want to edit if you wish to:

  • save the customer as a wholesale customer
    The customerType field in the customers table does not appear in the query because it defaults to “0”, which means that all new customers are by default “retail” customers. If you want the new customer to be a wholesale customer (e.g. this is a customized version of login.asp), add to the query the customerType field with value “1”.
  • save the customer into a Pricing Category
    This assumes that you have already created a special Customer Pricing Category in your ProductCart Control Panel (e.g. “International Distributors”) and that you wish to automatically assign the new customer to that category. Look up the Pricing Category ID in the Control Panel, and then alter the query on login.asp adding the field idCustomerCategory with value = to the Pricing Category ID. This field does not existing in the default query because, by default, a new customer is not assigned to any Pricing Category.

It's important to note that this change will not take effect until the customer logs out and logs back in again. Using the method above the customer will be saved properly to the database but their session will not reflect the proper pricing category or wholesale/retail setting. You'll need to manually set these session variables in login.asp. To do so, find this line of code in login.asp near line 495:


.. and add the following lines beneath it, setting the values appropriately:

'// Hard-code these values so new registrants are setup properly to order immediately with proper pricing and privileges.
session("customerType")=<0 or 1>
session("customerCategory")=<price category id here>

QR Code
QR Code Understanding login.asp (generated for current page)