Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Showing an image only at certain hours


a.niedermann

Recommended Posts

Hey There!!

 

I would like to implement a call us for free button. Now the problem is that the button should be only visible on our site on business hours.

 

It would be great if anybody has a solution for this!

 

Thanks,

Andreas

Link to comment
Share on other sites

<?
$current_time = date(G);
if ($current_time >= 8 && $current_time < 16) {
echo tep_image(DIR_WS_IMAGES . 'phone_support.gif', 'now open for your calls');
}
?>

 

Remember that this takes the server time, so it must be set to your local time, or you have to change the hours in the script....

Link to comment
Share on other sites

<?
$current_time = date(G);
if ($current_time >= 8 && $current_time < 16) {
echo tep_image(DIR_WS_IMAGES . 'phone_support.gif', 'now open for your calls');
}
?>

 

Remember that this takes the server time, so it must be set to your local time, or you have to change the hours in the script....

 

 

Hey Hellas!

 

Thanks a lot! Is there any way of including the days (button should also not show on saturday and sunday)

 

Andreas

Link to comment
Share on other sites

Hey There!!

 

I would like to implement a call us for free button. Now the problem is that the button should be only visible on our site on business hours.

 

It would be great if anybody has a solution for this!

 

Thanks,

Andreas

 

I don't know what your level of PHP is but I'd find the code for the button and put it so it's inside and if statement and use something like fate('G'); to find the hour and compare it to your buisness hours. You'd just have to watch that it compensates.

 

I would write the code if I had time.

 

Hope that helps anyway.

Link to comment
Share on other sites

I don't know what your level of PHP is but I'd find the code for the button and put it so it's inside and if statement and use something like fate('G'); to find the hour and compare it to your buisness hours. You'd just have to watch that it compensates.

 

I would write the code if I had time.

 

Hope that helps anyway.

 

hehe someone else must have replied whule i was writing.

Link to comment
Share on other sites

<?
$current_time = date(G);
$current_day = date(D);
if ($current_time >= 8 && $current_time < 16 && $current_day != 'Sat' && $current_day != 'Sun') {
echo tep_image(DIR_WS_IMAGES . 'phone_support.gif', 'now open for your calls');
}
?>

 

Holidays as well?

Link to comment
Share on other sites

<?
$current_time = date(G);
$current_day = date(D);
if ($current_time >= 8 && $current_time < 16 && $current_day != 'Sat' && $current_day != 'Sun') {
echo tep_image(DIR_WS_IMAGES . 'phone_support.gif', 'now open for your calls');
}
?>

 

Holidays as well?

 

 

Great Hellas :) !!

 

Yes, if possible, holidays (Switzerland) as well...

 

Thanks a lot! Andreas

Link to comment
Share on other sites

Have a look at the php date function, with the above example you must be able to figure out a lot.

 

For testing the regional settings of your server (time , day) you can build a test.php file, place it on your server and add a line

<?php echo 'Hour: ' . date(G) . ' Day: ' . date(D); ?>

 

Tip: For your holidays you could use the weeknumbers...

Link to comment
Share on other sites

Have a look at the php date function, with the above example you must be able to figure out a lot.

 

For testing the regional settings of your server (time , day) you can build a test.php file, place it on your server and add a line

<?php echo 'Hour: ' . date(G) . ' Day: ' . date(D); ?>

 

Thanks a lot Hellas!!

 

One question remains. The callus code comes from jajah.com and is a pre defined link....since my knowledge is limited I do not really know how to implement your code to the jajah.com predefined one...it would be great if you could help me with it!

 

Jajah predefined code:

<a href="http://www.jajah.com/mini?pid=E7D5BC7A&ShowReg=1&ShowLogin=1&title=company&d=0041813301675" onclick="(window.open('http://www.jajah.com/mini?pid=E7D5BC7A&ShowReg=1&ShowLogin=1&title=company&d=0041813301675',null,'menubar=no,height=230,width=230')).focus();return false;"><img src="http://www.numis-online.ch/images/callus.gif" alt="" border="0" /></a>

Link to comment
Share on other sites

<?
$current_time = date(G);
$current_day = date(D);
if ($current_time >= 8 && $current_time < 16 && $current_day != 'Sat' && $current_day != 'Sun') { ?>
<a href="http://www.jajah.com/mini?pid=E7D5BC7A&ShowReg=1&ShowLogin=1&title=company&d=0041813301675" onclick="(window.open('http://www.jajah.com/mini?pid=E7D5BC7A&ShowReg=1&ShowLogin=1&title=company&d=0041813301675',null,'menubar=no,height=230,width=230')).focus();return false;"><img src="http://www.numis-online.ch/images/callus.gif" alt="" border="0" /></a>
<?php } ?>

 

Remember: Linking to an external image will produce a ssl certificate error for the ssl pages (if applies).

Link to comment
Share on other sites

<?
$current_time = date(G);
$current_day = date(D);
if ($current_time >= 8 && $current_time < 16 && $current_day != 'Sat' && $current_day != 'Sun') { ?>
<a href="http://www.jajah.com/mini?pid=E7D5BC7A&ShowReg=1&ShowLogin=1&title=company&d=0041813301675" onclick="(window.open('http://www.jajah.com/mini?pid=E7D5BC7A&ShowReg=1&ShowLogin=1&title=company&d=0041813301675',null,'menubar=no,height=230,width=230')).focus();return false;"><img src="http://www.numis-online.ch/images/callus.gif" alt="" border="0" /></a>
<?php } ?>

 

Remember: Linking to an external image will produce a ssl certificate error for the ssl pages (if applies).

 

Thank you a lot for your efforts!! I appreciate it very much!

 

Andreas

Link to comment
Share on other sites

Just add following in the if() statement

 

&& $current_time != 12

 

Could I apply for phone operator job? I see I would have lots of free time :lol:

Link to comment
Share on other sites

:) true, true....but as I see you are from Greece and as my common understanding is as a person from Switzerland, you are drinking more ouzo than working :)

 

Thanks again for your help!!!

 

Andreas

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...