Post by bandergrove » Wed Sep 09, 2009 1:52 am

I would like to create a static splash / landing / login page leading into the our OpenCart site when users first visit the site. It will have just a simple Login / Register form, along with some static content. (It shouldn't use an OpenCart template -- just be a static HTML file separate from OpenCart.)

The shopping cart I'm creating is for approved wholesale shoppers only, so visitors who do not have an account shouldn't be able to access OpenCart, and should only be able to see this splash page.

However, logged in users should be redirected to the front page of the shopping cart.

Anyone have tips on how to implement this?

Thanks!

Newbie

Posts

Joined
Fri Jul 24, 2009 6:45 am

Post by gocreative » Sat Mar 20, 2010 9:24 am

I can't give you all of the actual code to achieve it, but I would suggest the following:
  • At the very beginning of the code in OpenCart's store front, write a small function that checks for a particular session cookie, such as "skip_splash".
  • If that cookie exists, go to the normal OpenCart store front.
  • If the cookie DOESN'T exist, take them to an alternative link, such as "index2.php"
  • That page would then include your code for users to sign up (or whatever else you want to do)
  • At the end of the signup process, set the session cookie "skip_splash" so that next time they visit your site, they'll skip the splash screen and go straight to the store.
Again, sorry I can't provide the code (I'm not a programmer) but I've done something similar before on another non-OpenCart site and that's how it was done.

User avatar
Active Member

Posts

Joined
Tue Jan 12, 2010 5:46 pm

Post by gocreative » Sat Mar 20, 2010 10:03 am

I had a go at it, and this is what I've done:

1. Created a new page, enter.php, which has this at the very beginning:

Code: Select all

<?PHP setcookie("skip_splash"); ?>
2. Edited index.php (in the very root of OpenCart) as follows:

a) At the start of the file, I added:

Code: Select all

if (isset($_COOKIE['skip_splash'])) {
b) at the end, I added:

Code: Select all

} else {
	header('Location: enter.php');
}
So, now any new visitor will see enter.php, and they click a link to take them to the OpenCart index page. Once there, the cookie to skip the splash page is set, and they enter the site. I haven't set a cookie expiry time/date but I'm sure you can take it from here.

Hope that helps.

User avatar
Active Member

Posts

Joined
Tue Jan 12, 2010 5:46 pm
Who is online

Users browsing this forum: No registered users and 206 guests