Post by taran_117 » Wed Jan 18, 2017 8:10 pm

Hi All

I am trying to create cutoff time for date picker wherein I am am using following code to define cutoff time as 5 PM. if the time is before 5 PM the date picker should show same day but after 5 PM the datepicker should show next date. The code seems working in noemal php file but its not working in product.tpl file.

Code: Select all

<?php 
date_default_timezone_set('Asia/Calcutta');
$Date = date('d-m-Y');
$time = date("Hi");
$sdcutoff = '1700';
if ($time > $sdcutoff && $jan == 'Same Day')
            {$minDate = date('d-m-Y', strtotime(' +1 days'));}
        elseif ($time < $sdcutoff && $jan == 'Same Day')
            {$minDate = date('d-m-Y');}
else
{$minDate = date('d-m-Y', strtotime($Date. ' + ' .$jan));}
?>
<script type="text/javascript">
$('.date').datetimepicker({
	format: 'dd-mm-yyyy',
	startDate: '<?php echo $minDate; ?>',
	minDate: '<?php echo $minDate; ?>',
	defaultDate: '<?php echo $minDate; ?>',
	pickTime: false
});

$('.datetime').datetimepicker({
	pickDate: true,
	pickTime: true
});

$('.time').datetimepicker({
	pickDate: false
});
Let me know if I am doing some mistake

Thanks In advance.

New member

Posts

Joined
Sun Apr 29, 2012 9:26 pm

Post by opencartmart » Wed Jan 18, 2017 11:37 pm

taran_117 wrote:The code seems working in noemal php file but its not working in product.tpl file.

It could be for ocmod cache. Please try refreshing ocmod in admin -> Extensions -> Modifications.

XForm - Opencart Form Builder

Xshippingpro - An advanced Shipping Module


Active Member

Posts

Joined
Wed Oct 02, 2013 3:59 am

Post by taran_117 » Thu Jan 19, 2017 2:07 am

Hi opencartmart

Thanks for the reply. Have tried that too. But no luck!!!

Thanks
Taran

New member

Posts

Joined
Sun Apr 29, 2012 9:26 pm
Who is online

Users browsing this forum: No registered users and 62 guests