View Full Version : Order cut off time
Hi there,
This is probably very simple for those in the know.
I'm after showing a line of text (probably in various locations) saying something like
"PLEASE NOTE:
Our order cutoff time of 4pm has passed and as such all orders placed now will be shipped the next working day. "
How can i do this but only make it appear after say 4pm only?
I reckon javascript or something is the answer but can anyone quickly write it for me?
Any help appreciated
Simon
NormanRouxel
25-Oct-2003, 04:31 PM
Here are two ways.
1) Make a copy of the Product Template and put this in
<script language=JavaScript>
now = new Date();
if ( now.getHours() >= 16 ) document.write('<font color=red>Our order cutoff time of 4pm has passed and as such all orders placed now will be shipped the next working day</font>');
</script>
2) Or put this into the Product Description
!!<<script language=JavaScript>
now = new Date();
if ( now.getHours() >= 16 ) document.write('<font color=red>Our order cutoff time of 4pm has passed and as such all orders placed now will be shipped the next working day</font>');
</script>>!!
In both cases the if line is one very long line.
Of course this depends on your customer having their clock set correctly and that bthey don't take ages in the checkout.
If you want to use the time on your server then this would be much more complicated.
Norman
Hi Norman,
Have tried that and it works (well you knew that already).
I decided to put the code into act_primary and it works quite well.
1. Do you think putting the code in act_primary should cause any problems?
2. Editing the caption is self-explanatory but altering the cut off time looks a bit confusing. How and why does 16 mean 4pm?
What is the method here of working out the time conversion?
3. When would the caption be removed? I assume midnight?
Thanks again for your help.
Simon
NormanRouxel
26-Oct-2003, 12:33 AM
1. Do you think putting the code in act_primary should cause any problems?
No. It will appear on every page (including the checkout ones). This would be a good thing as it would appear at the very end if the customer took ages to finalise their order and that took them past 4:00. Indeed one could amend it (or create a new one that put up a different warning if the time was (say) 15:45 to warn them to hurry up.
2. Editing the caption is self-explanatory but altering the cut off time looks a bit confusing. How and why does 16 mean 4pm?
4pm. 16:00 hours - we just poick out the hours part.
What is the method here of working out the time conversion?
The new Date() return the date and time on the customers system. If they've got it set wrong then they'll be misinformed. You can always blame them for not setting their system clock correctly if they complain.
3. When would the caption be removed? I assume midnight?
after 23:59 the time will be 00:00 and thus 0 will be returned and no warning will occur.
Norman
p.s. You can test all this by fiddling with the clock on your system and refreshing the page.
Thank you very much norman,
Again, problem solved with great speed and in leymans terms.
I do like the sound of your idea Indeed one could amend it (or create a new one that put up a different warning if the time was (say) 15:45 to warn them to hurry up.
I would ideally like to have the warning to customers you mentioned I.E "Our cut off time of 4pm is approaching.." then when 4pm arrives the cut off message is dispalyed.
I have no real experience in javascript (except these scripts that I have added to actinic etc).
I think simply adding another line for the warning message may conflict with the other one when times cross.
How would you amend the script to allow the warning message and then switch to the cut off message at say 4pm?
Thanks in advance
Simon
NormanRouxel
26-Oct-2003, 01:03 PM
above the line
if ( now.getHours() >= 16 ) document.write('<font color=red>Our order cutoff time of 4pm has passed and as such all orders placed now will be shipped the next working day</font>');
add the line
if ( (now.getHours() == 15) && (now.getMinutes() >= 30) ) document.write('<font color=red>Our cut off time of 4pm is approaching!</font>');
This will warn from 3:30pm until 3:59 and after that the other warning will operate.
Norman
Many thanks,
I have now altered the messages and times and have if up and running on my site.
Just what I was after.
Thanks for all your help
Simon
vBulletin® v3.8.4, Copyright ©2000-2012, Jelsoft Enterprises Ltd.