Creating a Dealer-Only Ecommerce Store

Last Updated: May 30, 2014 01:47PM EDT

Overview


With ProductCart you can easily setup your store so that only authorized users can access it. This article describes the steps to take to do so.

The article assumes that you have a basic knowledge of ASP programming. Please remember that ProductCart does not offer technical support on this sort of custom project.
 

Who has access? Wholesale only or specific customer groups?


First, you need to decide who will have access to the store. Will it be only wholesale customers? Or customers belonging to one or more “customer pricing categories”? This matters because the code to use changes. For now, let's assume you want a store that only wholesale customers can access (e.g. dealers, resellers, distributors, etc.).


Restricting access

To restrict access, you can simply check one of the following variables, and redirect if the value is not what you are looking for. Click on each link for more information.


Steps to take

 
Edit header.asp
Edit header.asp to implement your logic. Depending on which session variable you want to use the code will change slightly, but the idea remains the same: if a certain session variable does not exist, the customer is redirect to another page. It's up to you to redirect to the login page, or keep the login page hidden elsewhere and simply redirect to a page that provides some generic information.

The code to redirect should be placed at the top of header.asp and should be something like this (here we look to see if the customer belongs to one of two customer pricing categories - this is just an example):
<%
if session("customerCategory")<>"2" and session("customerCategory")<>"3" then
    response.redirect "page.html"
    response.end
end if
%>
If - instead of leveraging customer categories - you wanted to create a “wholesale only” store, the code would become:
<%
if session("customerType")<>"1" then
    response.redirect "page.html"
    response.end
end if
%>
Of course, “page.html” can be any URL. However, make sure that it is not a page that uses header.asp. Otherwise you would create an infinite loop.
 
Create a login page
Clearly, your login page cannot contain header.asp, or you are stuck in a loop! Instead, place a login page on another page, outside of ProductCart. This is very easy to do. You can use this article as a reference.
 
Inform your customers
Lastly, you will need to provide instructions to your customers on what they need to do to gain access to the store. If you give customers access to a registration form, you will still need to manually change their customer status after they have registered, otherwise they remain “retail” customers and cannot login.

Advanced users could also create a modified version of the registration page (login.asp) that automatically assigns the customer status (e.g. automatically sets the customer as a wholesale customer or assigns the customer to a specific customer pricing category).
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