Hope this is the right forum for this, appologies if its not.
I installed a magento plugin to show business hours on a CMS page but the 2nd part of the plugin that shows your full weeks opening hours doesnt work. I'm running a local install of magento 1.6.1 and this plugin hasnt been updated since 1.4 but what its doing is really just pulling values from the DB so I'm thinking its just some small error/change in the code
The php/mysql kills the magento page, it basically is blank.
Can anyone see any mistakes in the code that may cause this ? I think this is a very useful plugin and would love to get it working and post back up the working code for anyone who may also want to use it.
PHP Code:
<?php
date_default_timezone_set(Mage::getStoreConfig('businesshours/general/timezone'));
$days=array('sun','mon','tue','wed','thu','fri','sat');
$start=date("w",time());
$j=0;
for($i=0+$start;$i<=6+$start;$i++){
$dow[$j]=$days[$i%7];
$j++;
}
foreach($dow as $day) {
${$day.'_open'} = Mage::getStoreConfig('businesshours/general/'.$day.'_open');
${$day.'_close'} = Mage::getStoreConfig('businesshours/general/'.$day.'_close');
}
?>
<div class="fullschedule">
<div id="header">
<?php echo "<strong>".$this->__('Business Hours')."</strong>\n" ?>
</div>
<div id="schedule">
<?php
foreach($dow as $day) {
switch($day) {
case 'mon': echo $this->__('Monday');
break;
case 'tue': echo $this->__('Tuesday');
break;
case 'wed': echo $this->__('Wednesday');
break;
case 'thu': echo $this->__('Thursday');
break;
case 'fri': echo $this->__('Friday');
break;
case 'sat': echo $this->__('Saturday');
break;
case 'sun': echo $this->__('Sunday');
}
if(${$day.'_open'} != '') {
$result=$this->getIsClosed(date('Y-m-d',time()+60*60*24));
if($result[0])
echo ": ".$this->_('CLOSED')."<br>\n";
else
echo ": ".${$day.'_open'}.$this->__(' to ').${$day.'_close'}."<br>\n";
} else {
echo ": ".$this->_('CLOSED')."<br>\n";
}
}
?>
</div>
</div>