Page 1 of 1

Create a static Splash / Landing page?

Posted: Wed Sep 09, 2009 1:52 am
by bandergrove
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?


Re: Create a static Splash / Landing page?

Posted: Sat Mar 20, 2010 9:24 am
by gocreative
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.

Re: Create a static Splash / Landing page?

Posted: Sat Mar 20, 2010 10:03 am
by gocreative
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.