Zen Cart Logo
Forums / General Questions / Is It Possible To Create A One-Time Popup "In Front Of" The Index.php Page?

Is It Possible To Create A One-Time Popup "In Front Of" The Index.php Page?

Views: 543

Results 1 to 2 of 2
31 Mar 2016, 11:42 PM
#1
dk_scully avatar

dk_scully

Zen Follower

Join Date:
Jan 2011
Posts:
339
Plugin Contributions:
0

Is It Possible To Create A One-Time Popup "In Front Of" The Index.php Page?

We'd like to create a pop-up that will appear when a person visits a site. We'll be using it as an adult-site warning, so it needs to have responsive "enter" and "go away" buttons...and only appears when the site initially loads. It won't appear again no matter how many pages the person views...but if they close the site and come back, it will reappear.

Is that possible using ZenCart? If not, can someone suggest a different program that can do the job?

Thanks very much for your help!

1 Apr 2016, 1:10 PM
#2
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,100
Plugin Contributions:
56

Re: Is It Possible To Create A One-Time Popup "In Front Of" The Index.php Page?

That's certainly possible! The easiest way would be to add an extra-function file (in /includes/functions/extra_functions) that checks to see whether the customer has already accepted the warning (by interrogating whether the variable $_SESSION['warning_accepted'] is set).

If that variable is not set, the customer is redirected to a new page ('welcome') that displays your message with a checkbox that indicates that they've read and accept the 'warning' and a "go" button.

When the customer clicks the go-button, the welcome page's processing checks to see if the checkbox has been checked. If the checkbox has been checked, the variable $_SESSION['warning_accepted'] is set to true and the customer is redirected to the main/index page; otherwise, the "welcome" page is redisplayed.