Hello, friends! In this post, I want to explain how to implement an events calendar in osCommerce. With this feature, you can schedule products and display which events/products are scheduled for specific dates. I’ve also provided a demo implemented in Smarty application.

In the dynamic world of e-commerce, an events calendar can be a valuable addition to your osCommerce website. This article will guide you through the process of implementing an events calendar in osCommerce using PHP code. With this feature, you can schedule and showcase products or events, making it easier for your customers to keep track of important dates and offerings. Whether you’re managing product launches, promotions, or special events, the ability to display these activities on a calendar can enhance the user experience and drive engagement.

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 :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?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:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<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>

In conclusion, the implementation of an events calendar in osCommerce using PHP code is a powerful tool for e-commerce website owners and administrators. This article has equipped you with the knowledge and steps required to seamlessly integrate an events calendar into your osCommerce platform. By scheduling products and displaying events, you can improve user engagement and make it easier for customers to stay informed about your offerings. This feature not only enhances user experience but also provides a practical way to manage and showcase key activities on your website. With an events calendar, you’re well-prepared to keep your customers engaged and informed.


4 Comments

sekhar · July 7, 2010 at 9:00 pm

Great informations of php code collections. Thanks for sharing.

Pragnesh Karia · May 11, 2011 at 2:39 pm

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

anju · January 19, 2012 at 3:37 am

Your demo is not working…

Anil Kumar Panigrahi · January 19, 2012 at 6:46 pm

@Pragnesh, @Anju, This is a demo only. It is displaying the calendar only.

Leave a Reply

Avatar placeholder

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