osCommerce - How to make a dealer only site
I was running myself stupid searching for a way to make osCommerce into a dealer only site. I didn’t need much, I just wanted users that weren’t logged in to not be able to see much. I wanted unauthenticated users to only be able to see the login page (of course), the FAQ, Contact page, and a few information pages.
There are other osCommerce contributions that feature different pricing per customer and stuff like that. But I think there are a lot of people like me that just needed to restrict access to the prices, product info and such.
I’ve got a bit of a caveat. I am running CRE Loaded 6.2. I’m sure it’s fairly simple to find the file this code should be in with a standard osCommerce install.
Here are the modifications:
In file [/templates/Original/header.php]:
at about line 18, just after this line of code:
if (DOWN_FOR_MAINTENANCE_HEADER_OFF =='false') {
Add this code:
//CUSTOM FOR DEALER ONLY SITE!!
if (!tep_session_is_registered('customer_id')) {
switch($_SERVER['REQUEST_URI']) {
case '/login.php':
case '/login.php?action=process';
case '/contact_us.php':
case '/links.php':
case '/information.php?info_id=1':
case '/information.php?info_id=2':
case '/information.php?info_id=3':
case '/login.php':
case '/password_forgotten.php':
break;
default:
header('Location: /login.php');
break;
}
You’ll likely want to modify the list of ‘allowable’ files, but this should be a great start if you want simple dealer only or a dealer portal osCommerce application.
2 comments July 7th, 2006