Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Show a shadowbox in index only once


Mc_Gregor

Recommended Posts

Hiii all...

I incorporated a shadowbox to display an image in index, when they open the web.

My problem is that the shadowbox opens each click on each category.

/index.php?cPath=1 - /index.php?cPath=2 - /index.php?cPath=3 etc. etc....

 

I just want to shown the shadowbox "once", as a promotional image in index.php

 

In catalog\includes\template_top.php i add this line inside the <head> </head>

<link rel="stylesheet" type="text/css" href="shadow/shadowbox.css">
<script src="shadow/shadowbox.js" type="text/javascript">
</script> <script type="text/javascript">
Shadowbox.init({
   language:   "es",
   players:    ['html']
   }); 
function AlertMessage()
   {
   Shadowbox.open({
       player:     'img', 
       content:    'images/myimage.gif',
       height:     200,
       width:      240
       });
   }
</script>

 

And i call the function from catalog\includes\languages\english.php (in the last line)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head></head>
<body onload="AlertMessage();">

 

This work but in every category.. I only whant to show once when the visitors in.

 

Is only a promotional shadowbox instead of annoying popup..

 

Apreciate any help please :blush:

 

Cheers

Link to comment
Share on other sites

Try this code in place of your existing code:

 

<link rel="stylesheet" type="text/css" href="shadow/shadowbox.css"> 
<script src="shadow/shadowbox.js" type="text/javascript"> 
</script> <script type="text/javascript"> 
Shadowbox.init({ 
   language:   "es", 
   players:    ['html'] 
   });  
function AlertMessage() 
   { 
<?php
 if ( tep_session_is_registered('Popped') )
   echo 'return;' . "\n";
 else {
   tep_session_register('Popped');
?>
   Shadowbox.open({ 
       player:     'img',  
       content:    'images/myimage.gif', 
       height:     200, 
       width:      240 
       }); 
<?php
 }
?>
   } 
</script>

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

Hi germ.. Nice, that work!

But, what it does really? appears only once, if not in the "tep_session_is_registered"? and after 5 or 15 min appear again?. (I mean for one ip address), could explain it?

 

Thanks!!!..

 

Cheers..

Link to comment
Share on other sites

In 25 words or less it uses a session variable to ensure it only gets displayed once (for that session).

 

Of course if the session is lost or "times out" it will be displayed once again for the new session.

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...