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!

Showing different content based on the customer type

Retail vs. Wholesale customers

In ProductCart it's easy to show different content based on who is viewing the page. Once a customer has logged in, ProductCart sets session variables to identify the customer type.

session("customerType")="1"

… means that the customer is a wholesale customer. So to show a certain portion of HTML code only to a wholesale customer, you would use something like the following:

<% If session("customerType")="1" then %>
 This is shown only to wholesale customers
<% else %>
 This is shown to retail customers
<% end if %>

A wholesale-only store

If you don't want the customer to view a page unless they are logged in as a wholesale customer, you can redirect them to another page using the following code.

<%
if session("customerType")<>"1" then
    response.redirect "page.html"
    response.end
end if
%>

If you place this code in header.asp, then customers will not be able to use the store at all unless they are logged in as a wholesale customer. To do so, of course, you need to place a login form on a page that does not use header.asp.

You can find more information on creating a dealer-only store here.

Leveraging Customer Pricing Categories

As you know, you can also assign a customer to a pricing category in ProductCart. When you do so, at the time the customer logs in, another useful session variable is set.

session("customerCategory")

The value assigned to the session variable is the ID of the Customer Pricing Category. You can view this value when you add/edit a pricing category in the Control Panel.

So - similarly to the above - you can very easily show/hide content based on whether a customer belongs to a specific customer category. For example, assume that the ID of the Pricing Category “Preferred Customers” is 20. The code would read…

<% If session("customerCategory")="20" then %>
 This is shown only to "Preferred Customers"
<% else %>
 This is shown to other customers
<% end if %>

Note that you can use Customer Pricing Categories even if the discount is 0. That is, they can help you separate customers into different categories regardless of whether or not those customers also receive a different price.

Different looking storefronts for different customers

Advanced users will appreciate the fact that the above can be used to potentially show a completely different graphical interface based on the customer type or the customer category. That is, the files header.asp and footer.asp could contain IF statements based on the session variables mentioned above and load completely different HTML (e.g. entirely different DIVs, images, navigation, etc.).


QR Code
QR Code Showing different content based on the customer type (generated for current page)