Hi friends, In this post i want to explain how to implement events calender in oscommerce. We can schedule the products and we can display the which events/products are schedule in which date. And i have implemented demo in smarty application.
Screenshot of event calendar :

Events calender implementation in oscommerce using php code | Anil Labs
Call that function in any of your file like :
<?php
$year=date('Y');$month=date('m');
?>
<select id="year" name="year" onChange="getResult();">
<?php for($i=2000;$i<2020;$i++){ ?>
<option value="<?php echo $i;?>" <?php if($i==$year){?> selected="selected"<?php }?> ><?php echo $i;?></option>
<?php } ?>
</select>
<select id="month" name="month" onChange="getResult();">
<?php for($i=1;$i<=12;$i++){?>
<option value="<?php echo $i;?>" <?php if($i==$month){?> selected="selected"<?php }?>><?php echo $i;?></option>
<?php } ?>
</select>
</div>
<div id="txtResult" align="center">
<?php
echo generate_calendar($year,$month);
?>
$year=date('Y');$month=date('m');
?>
<select id="year" name="year" onChange="getResult();">
<?php for($i=2000;$i<2020;$i++){ ?>
<option value="<?php echo $i;?>" <?php if($i==$year){?> selected="selected"<?php }?> ><?php echo $i;?></option>
<?php } ?>
</select>
<select id="month" name="month" onChange="getResult();">
<?php for($i=1;$i<=12;$i++){?>
<option value="<?php echo $i;?>" <?php if($i==$month){?> selected="selected"<?php }?>><?php echo $i;?></option>
<?php } ?>
</select>
</div>
<div id="txtResult" align="center">
<?php
echo generate_calendar($year,$month);
?>
Implementation in Ajax functionality:
<script language="javascript" type="text/javascript">
function getResult()
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
}
year=document.getElementById("year").value;
month=document.getElementById("month").value;
//alert(year);
//alert(month);
document.getElementById('txtResult').innerHTML = "Getting...";
var url="call.php"
url=url+"?year="+year+"&month="+month
//alert(url);
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChanged
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
function stateChanged()
{
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{
document.getElementById("txtResult").innerHTML=xmlHttp.responseText;
//document.getElementById("hid").value=xmlHttp.responseText;
}
}
function GetXmlHttpObject()
{
var xmlHttp=null;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
//Internet Explorer
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}
</script>
function getResult()
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
}
year=document.getElementById("year").value;
month=document.getElementById("month").value;
//alert(year);
//alert(month);
document.getElementById('txtResult').innerHTML = "Getting...";
var url="call.php"
url=url+"?year="+year+"&month="+month
//alert(url);
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChanged
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
function stateChanged()
{
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{
document.getElementById("txtResult").innerHTML=xmlHttp.responseText;
//document.getElementById("hid").value=xmlHttp.responseText;
}
}
function GetXmlHttpObject()
{
var xmlHttp=null;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
//Internet Explorer
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}
</script>






Great informations of php code collections. Thanks for sharing.
Great blog,
Your demo http://labs.anil2u.info/events_calender.php
is not working.Giving java script error ‘addUnits is not defined’.
Your demo is not working…
@Pragnesh , @Anju , This is demo only. It is displaying the calender only.