osCommerce - How to make a dealer only site
July 7th, 2006
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.
Entry Filed under: Programming, osCommerce


2 Comments Add your own
1. Mustafa | February 18th, 2007 at 2:42 pm
I am using CRE Loaded 6.2 version to for my online shop. Thank you for you rvaluable tips and suggestions. i would like to create multiple member logins as retailers and customers two separate and allow them to access certain pages only. apart from this i want to create customer groups…can you please help…you can reach me on reachmustafa@gmail.com…
Thanx & Regards
Mustafa Kamal
2. Vadim | March 5th, 2008 at 7:49 pm
Hi,
in osCommerce this code i believe goes into application_top.php
Also in your sample code, u r missing } at the end and in
case \’/login.php?action=process\’; you accidentally typed ; instead of :
:-)
Thanks for the idea btw!!
Leave a Comment
Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>
Trackback this post | Subscribe to the comments via RSS Feed