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!
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.
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:
2. Edited index.php (in the very root of OpenCart) as follows:
a) At the start of the file, I added:
b) at the end, I added:
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.
1. Created a new page, enter.php, which has this at the very beginning:
Code: Select all
<?PHP setcookie("skip_splash"); ?>
a) At the start of the file, I added:
Code: Select all
if (isset($_COOKIE['skip_splash'])) {
Code: Select all
} else {
header('Location: enter.php');
}
Hope that helps.
Who is online
Users browsing this forum: No registered users and 206 guests