Skip to content

Instantly share code, notes, and snippets.

@webdawe
Created June 28, 2018 02:43
Show Gist options
  • Save webdawe/cfc22c739ceaa02a8d76853046f91216 to your computer and use it in GitHub Desktop.
Save webdawe/cfc22c739ceaa02a8d76853046f91216 to your computer and use it in GitHub Desktop.
<script src="<?php echo Mage::getBaseUrl('js')."calendar/calendar.js" ?>" type="text/javascript"></script>
<script src="<?php echo Mage::getBaseUrl('js')."calendar/calendar-setup.js" ?>" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="<?php echo Mage::getBaseUrl('js') ?>calendar/calendar-win2k-1.css"  />
<?php echo $this->getLayout()->createBlock('core/html_calendar')->setTemplate('page/js/calendar.phtml')->toHtml();?>
<label for="date_picker_id"><?php echo $this->__('Your Date 1') ?> </label>
<input type="text" name="shipping_pickup_at_store_date" class="datetime" value=""/>
<label for="date_picker_id"><?php echo $this->__('Your Date 2') ?> </label>
<input type="text" name="shipping_pickup_at_store_date_2" class="datetime" value=""/>
<script type="text/javascript">
// <![CDATA[
jQuery(document).ready(
function($)
{
$('input.datetime').each(function(){
var randomNumber = Math.floor((Math.random() * 100) + 1);
var element = $(this);
$(this).before('<img style="" title="Select Date" id="date_select_trig_' + randomNumber+'" alt="" src="<?php echo $this->getSkinUrl("images/calendar.gif");?> "/>');
Calendar.setup({
inputField: null,
daFormat: "%d/%m/%Y %H:%M:%S",
showsTime: true,
button: "date_select_trig_" + randomNumber,
align: "Bl",
singleClick : true,
onSelect: function(dateObj,selectedDate) {
$(element).val(selectedDate);
console.log(dateObj);
}
});
});
}
);
// ]]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment