How to Show Different Content Based on Customer Type

Last Updated: Jun 19, 2014 10:31AM EDT

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 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.).
647e99095133bd6d1ae916f97dc7f92f@productcart.desk-mail.com
https://cdn.desk.com/
false
desk
Loading
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
about
false
Invalid characters found
/customer/en/portal/articles/autocomplete