Or if you wanted to avoid cron jobs for whatever reason, you could take a different approach whereby you create a php file containing the following code and include it so it loads on each page visit to your site. It gets the current time and checks to see whether the store should be in normal mode or showcase mode and sets it accordingly. I'm not sure whether it would affect the speed of your site doing this on each page visit, but I think it should be okay.
PHP Code:
<?php
require('includes/application_top.php');
//Define opening time
$opening_time = "09:00:00";
$closing_time = "17:00:00";
//Remove characters
$opening_time = str_replace(':', '', $opening_time);
$closing_time = str_replace(':', '', $closing_time);
//Get current time
$t = time();
$now = date('His', $t);
//Check if it's opening time
if ( ($now > $opening_time ) && ( $now < $closing_time ) ) {
//opening time, put store in normal mode
$sql_opening="UPDATE configuration SET configuration_value = 0 where configuration_id = 23;";
$result_opening=$db->Execute($sql_opening);
} else {
//closing time, put store in showcase mode
$sql_closing="UPDATE configuration SET configuration_value = 2 where configuration_id = 23;";
$result_closing=$db->Execute($sql_closing);
}
?>
Bookmarks