Events calendar implementation in oscommerce using php code

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

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);
?>

 

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+"&amp;month="+month
//alert(url);
url=url+"&amp;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>

Anil Kumar Panigrahi

With more than 10 years experience in PHP and Founder of Anil Labs, a blog for PHP and related posts. contributed posts regarding CodeIgniter, CakePHP and Learn PHP online ... Contact : [email protected]

You may also like...

4 Responses

  1. sekhar says:

    Great informations of php code collections. Thanks for sharing.

  2. Great blog,
    Your demo http://labs.anil2u.info/events_calender.php
    is not working.Giving java script error ‘addUnits is not defined’.

  3. anju says:

    Your demo is not working…

  4. @Pragnesh , @Anju , This is demo only. It is displaying the calender only.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.