View Full Version : Calculating Delivery Dates
Is there any php scripting experts who could help with creating a script to display an anticipated delivery date?
Have seen this used on quiet a few sites and its different to the usual in stock next day delivery message and would look good.
Obviously it needs to take into weekends, bank holidays and current time of day
Is this too complicated to even consider?
Hi
This is definitely something I would use as all my items are handmade & say delivery is between 5-10 working days.....but what do people call working days obviously mine are 7days a week but my customers don't need to know this & would love their order to have an expected delivery date on the invoice so it saves me answering loads of emails to people about when they would receive their goods.
This is a subject that I'd definitely like to hear some more feedback about, bearing in mind possible differences between products, their shipping methods, part shipment, etc.
little-linguist
15-05-2008, 15:00
I agree that there could be an issue for people who offer a wide range of products / shipping methods as Rich highlighted. So if such a system is implemented perhaps keep the option for the existing stock availibility indicators to remain.
I think it's a great idea for people who have products with similar availibilites / shipping methods / shipping destinations, but probably wouldn't work for us.
Really like the idea of being able to specify a specific despatch date (and time even). We have a cut off time each day that we process orders up to, then any orders after this time get despatched the next day.
I've spoken to Rich before about being able to specify a different stock message on some products at variant level. Sometimes certain product options can be delayed where others are fine. Rich has said that it's a very complicated feature and not something that can be done easily. Even though I think Rich could easily justify the nickname "The Magician" we have to respect that some things are very complex and take time, and this is one of them.
If this feature was to get implemented eventually, I would like to see a global setting for what time your daily cutoff was, what your working days are and what your standard despatch delay would be (in days) for in stock and out of stock orders. Then, at variant level, have the option of stating different delays for any particular product that would override the default for out of stock items.
The customer would then see an accurate despatch date for each product.
Not something that we need right now, but i could see it coming in handy in the future. Also, it would look more professional.
When our site was on Craptinic we had a bit of Javascript that worked in conjunction with the server time and counted down hours and minutes to the despatch cut off time ie 'Order in the next 1 hour 6 minutes for despatch today'.
This was very successful for generating more next working day orders and did compensate for weekends by adding 1 or 2 days, the only problem was with moveable non working days (Bank Holidays).
This was a crib of the type of message displayed by Amazon and I'm sure Rich could easily incorporate something similar if people wanted it, I should have the script knocking around somewhere, although it's written for Craptinic it should be adaptable.
It would need some input from you to adjust the countdown parameters for your own despatch habits, we used it as a tool to increase conversions, if people can see time is running out they are more inclined to get on with the order.
When our site was on Craptinic we had a bit of Javascript that worked in conjunction with the server time and counted down hours and minutes to the despatch cut off time ie 'Order in the next 1 hour 6 minutes for despatch today'.
This was very successful for generating more next working day orders and did compensate for weekends by adding 1 or 2 days, the only problem was with moveable non working days (Bank Holidays).
This was a crib of the type of message displayed by Amazon and I'm sure Rich could easily incorporate something similar if people wanted it, I should have the script knocking around somewhere, although it's written for Craptinic it should be adaptable.
It would need some input from you to adjust the countdown parameters for your own despatch habits, we used it as a tool to increase conversions, if people can see time is running out they are more inclined to get on with the order.
This is exactly the sort of thing we are looking for and if Rich could incorporate this into Bluepark it would be great.
If anyone does next day delivery you might find the following script of some use. It checks the current time and if less than 5pm (our cut-off time) will display the delivery date ie Thursday 11th September
If the time is later then 5pm it will assume delivery will be in two days time ie Friday 12th September
Also it will also recognise Saturday & Sunday and display the delivery date as a Tuesday xx xxxxxxx
I am using this on one of sites within a block on the right and you can see it here
http://www.hptonercartridges.co.uk/hp-colour-laserjet-2605/q6000a-hp-colour-laserjet-1600-2600-2605-black-toner.html
The only thing it can not do is recognise bank holidays, christmas etc but we just change the block with another block saying how long we are closed for.
Finally, if your cut-off time for next day delivery is earlier than 5pm just change the following line
if ( myDate.getHours() < 17 ) // less than 5pm
<script type="text/javascript">
<!--
var myDate=new Date();
if ( myDate.getHours() < 17 ) // less than 5pm
{
var daystodeliver = [2,1,1,1,1,3,2][myDate.getDay()];
}
else
{
var daystodeliver = [2,2,2,2,2,4,3][myDate.getDay()];
}
myDate.setDate(myDate.getDate()+daystodeliver);
document.write(['Sunday','Monday','Tuesday','Wednesday','Thursday' ,'Friday','Saturday'][myDate.getDay()]);
var dayofmonth = myDate.getDate();
suffix = ((dayofmonth < 10)||(dayofmonth > 20)) ? ['th','st','nd','rd','th','th','th','th','th','th'][dayofmonth % 10] : 'th';
document.write(' ' + dayofmonth + suffix + ' ');
document.write(['January','February','March','April','May','June', 'July','August','September','October','November',' December'][myDate.getMonth()]);
// -->
</script>
Just found an error in the coding so heres the revised version
<script type="text/javascript">
<!--
var myDate=new Date();
if ( myDate.getHours() < 17 ) // less than 5pm
{
var daystodeliver = [2,1,1,1,1,3,3][myDate.getDay()];
}
else
{
var daystodeliver = [2,2,2,2,4,4,3][myDate.getDay()];
}
myDate.setDate(myDate.getDate()+daystodeliver);
document.write(['Sunday','Monday','Tuesday','Wednesday','Thursday' ,'Friday','Saturday'][myDate.getDay()]);
var dayofmonth = myDate.getDate();
suffix = ((dayofmonth < 10)||(dayofmonth > 20)) ? ['th','st','nd','rd','th','th','th','th','th','th'][dayofmonth % 10] : 'th';
document.write(' ' + dayofmonth + suffix + ' ');
document.write(['January','February','March','April','May','June', 'July','August','September','October','November',' December'][myDate.getMonth()]);
// -->
</script>
reefphyto
11-11-2008, 23:24
I love this idea, does anyone have an idiots guide how to implement this into my site?
Regards Darren
I love this idea, does anyone have an idiots guide how to implement this into my site?
Regards Darren
Hi Darren,
Welcome to the Forum
I am using this script on 2 of my websites (1 under development). On one of the sites the delivery information in shown in a block on the right hand side of the screen and on the other site it is shown in the centre block against availability.
Its really depends on the layout you are using and where you want the information to be displayed on your product page.
Easiest solution is to create a block in the block manager and copy and paste the script into the block editor. Then go in layout manager, select standard page and activate the block to show in the right column.
reefphyto
13-11-2008, 21:10
Hi Dave,
I have followed your instructions to the letter but all i am getting in the box is a date ie 17th November 2008 and nothing else ?
Any ideas
Regards Darren
reefphyto
23-11-2008, 23:52
Just found an error in the coding so heres the revised version
<script type="text/javascript">
<!--
var myDate=new Date();
if ( myDate.getHours() < 17 ) // less than 5pm
{
var daystodeliver = [2,1,1,1,1,3,3][myDate.getDay()];
}
else
{
var daystodeliver = [2,2,2,2,4,4,3][myDate.getDay()];
}
myDate.setDate(myDate.getDate()+daystodeliver);
document.write(['Sunday','Monday','Tuesday','Wednesday','Thursday' ,'Friday','Saturday'][myDate.getDay()]);
var dayofmonth = myDate.getDate();
suffix = ((dayofmonth < 10)||(dayofmonth > 20)) ? ['th','st','nd','rd','th','th','th','th','th','th'][dayofmonth % 10] : 'th';
document.write(' ' + dayofmonth + suffix + ' ');
document.write(['January','February','March','April','May','June', 'July','August','September','October','November',' December'][myDate.getMonth()]);
// -->
</script>
Hi Dave,
I have managed to get this working thanks,
A quick question, if we do not dispatch goods on Fridays what part of the code would i need to change ?
At the moment on FRIDAY it show next delivery day as Monday which is correct, we we need it to show Tue instead.
Regards Darren
Hi Darren
I am away from the office at present so are unable to post the amended code as you require. However the change is fairly simple.
The days to deliver start on a Sunday so you need to change the sixth number from 3 to 4 so it will add 4 days making it Tuesday (this is the first line of numbers)
On the second line of numbers where the time is greater than 17.00hrs you will need to change the fifth number for Thursday from 4 to 5
Have a look at the lines in question and I am sure it will make sense. If not post back let me know and I will post amended script when back in office.
reefphyto
24-11-2008, 10:59
Many thanks Dave ive changed the code and it looks good.
Regards Darren
Many thanks Dave ive changed the code and it looks good.
Regards Darren
Hi Darren,
That's great...thanks for letting me know.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.