Jump to content

Pop up if Catalogmode == 1 (useful for takeaways)


Sathees

Recommended Posts

Hello, I am making a website for a takeaway that offer delivery service as well.

I thought to make a little pop up when the shop is closed (I made also an event on the database to open the site in catalog mode and another to take it out of catalog mode, in coincidence with the shop timing, and changed also the files to show the price even if the site is in catalog mode.)

This script is included just before the </head> inside header.tpl, inside the theme that I am using.

 

The pop up code is included here, and can be used by anyone who has my same needs, as it took me around one week to come up with this as I am new. CSS file is also needed, please ask if you are interested, thanks.

 

Now after searching for another one week I just decided to give up and try to ask for help.

How can I include in this script a check that if catalog mode is set to 1 it will execute this pop up, otherwise no pop up is shown?

Basically:

If catalogmode == 1 then execute script else ignore pop up script.

 

Any suggestion will be much appreciated, thanks.

<script>
jQuery(document).ready(function($){
if (sessionStorage.getItem('advertOnce') !== 'true') {
$('body').append('<div id="advert-once">Sorry, The shop is closed at the moment. <br> However, you can browse our menu if you would like to.<br><br><center><button class="shopclosedOK">OK</button></center></div>')
sessionStorage.setItem('advertOnce','true');
}
 
$('#advert-once .shopclosedOK').on('click',function(){
$('#advert-once').hide();
});
</script>
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...