Results 1 to 6 of 6

Thread: Countdown Timer For Next Day Delivery

  1. #1
    Join Date
    Jan 2018
    Posts
    19

    Default Countdown Timer For Next Day Delivery

    Hi everyone i am wondering if it is possible to add a Countdown Timer For Next Day Delivery cut off time ? as seen on most websites.

    Any help will be great fully appreciated.

    Cheers,
    Rich

  2. #2
    Join Date
    Dec 2011
    Posts
    375

    Default

    I think you just find a script/code that you like and put this into a block.
    Gerard

    http://www.caressa.co.uk


    10% discount for Blueparkers - use couponcode bluepark13

  3. #3
    Join Date
    Jun 2012
    Location
    South West England
    Posts
    195

    Default

    Here is my version which you are welcome to use providing that you understand:
    1) It is free.
    2) You are 100% responsible for testing it and implementing it yourself
    3) It is unsupported by me after this post.
    4) If you have a better variant or improve this please post it here and help another Blueparker.

    You can see this at http://www.herniapants.com/hernia-underwear/515.html

    Some notes:
    1) You will have to change the cut-off time yourself, for me it is 17:00 so you will see 17 in the javascript. Just change it to your own cut-off time.

    2) It doesnt display on weekends as that is over-promising.

    3) For the last minute it doesnt display as its kind of pointless and might provoke panic/dispair, the minute the cut-off after it resets for the next 17:00 (assuming its a weekday)

    4) I am assuming that a friday shipment delivers on a Saturday e.g. R.M. Tracked/1st Class or simiar.

    5) I have done bank holidays for 2018 and 2019, check these yourself, add ,delete etc as you see fit. You will need to check these carefully.

    6) Some of my customers are US and Canada etc so I dont want to promise them a next-day delivery! I check for 'en-GB' language in the browser. This is not infallible but should limit
    the display to just UK or UK-based customers.

    7) It allows for plurals in the display so if its the last hour it says '1 hour' not 1 hours' which is bad grammer, the same for minutes.

    On the Product page that you want to put it:
    In the Optional Code tab insert the following:

    <script type = "text/javascript">


    function getSeconds() {

    var now = new Date();
    var weekday = now.getDay();
    if(weekday == 6 || weekday == 0) // dont run on weekends (Saturday=6, Sunday=0)
    {
    return;
    }

    MyDate = now.getDate();
    MyMonth = now.getMonth();
    MyYear = now.getFullYear();

    // Update Yearly to stay current
    // Month 0 = January, Month 11 = December in Javascript!

    if (MyMonth == 11 && MyDate == 24 && MyYear == 2018) {return;} // Christmas Eve
    if (MyMonth == 11 && MyDate == 25 && MyYear == 2018) {return;} // Christmas Day
    if (MyMonth == 0 && MyDate == 1 && MyYear == 2018) {return;} // New Years Day
    if (MyMonth == 2 && MyDate == 30 && MyYear == 2018) {return;} // Good Friday
    if (MyMonth == 3 && MyDate == 2 && MyYear == 2018) {return;} // Easter Monday
    if (MyMonth == 4 && MyDate == 7 && MyYear == 2018) {return;} // May Bank Holiday
    if (MyMonth == 5 && MyDate == 28 && MyYear == 2018) {return;} // Spring Bank Holiday
    if (MyMonth == 7 && MyDate == 27 && MyYear == 2018) {return;} // Summer Bank Holiday


    // 2019 Coded in
    if (MyMonth == 11 && MyDate == 24 && MyYear == 2019) {return;} // Christmas Eve
    if (MyMonth == 11 && MyDate == 25 && MyYear == 2019) {return;} // Christmas Day
    if (MyMonth == 0 && MyDate == 1 && MyYear == 2019) {return;} // New Years Day
    if (MyMonth == 3 && MyDate == 19 && MyYear == 2019) {return;} // Good Friday
    if (MyMonth == 3 && MyDate == 22 && MyYear == 2019) {return;} // Easter Monday
    if (MyMonth == 4 && MyDate == 6 && MyYear == 2019) {return;} // May Bank Holiday
    if (MyMonth == 4 && MyDate == 27 && MyYear == 2019) {return;} // Spring Bank Holiday
    if (MyMonth == 7 && MyDate == 26 && MyYear == 2019) {return;} // Summer Bank Holiday


    // If Browser is not set to GB then omit
    var browser_language = navigator.language;
    if (browser_language != 'en-GB')
    {
    return;
    }


    var time = now.getTime(); // time now in milliseconds
    var midnight = new Date(now.getFullYear(),now.getMonth(),now.getDate( ),17,00,0); // midnight 0000 hrs
    // midnight - change time hh,mm,ss to whatever time required, e.g. 7,50,0 (0750)
    var ft = midnight.getTime() + 86400000; // add one day
    var diff = ft - time;
    diff = parseInt(diff/1000);
    if (diff > 86400) {diff = diff - 86400}
    startTimer (diff);
    }


    var timeInSecs;
    var ticker;


    function startTimer(secs){
    timeInSecs = parseInt(secs);
    ticker = setInterval("tick()",1000);
    tick(); // to start counter display right away
    }


    function tick() {
    var secs = timeInSecs;
    if (secs>0) {
    timeInSecs--;
    }
    else {
    clearInterval(ticker); // stop counting at zero
    getSeconds(); // and start again if required
    }


    var hours= Math.floor(secs/3600);
    secs %= 3600;
    var mins = Math.floor(secs/60);
    secs %= 60;


    if (hours == 0 && mins == 0) // Dont show 00:00 for a minute
    {
    return;
    }


    if (hours == 0 && mins > 0){
    var result = ( mins + " minutes ");
    }
    else if (hours <= 1 && mins ==1){
    var result = ( hours + " hour " + mins + " minute ");
    }
    else if (hours <= 1 && mins ==0){
    var result = ( hours + " hour ");
    }
    else if (hours <= 1 && mins > 1){
    var result = (hours + " hour " + mins + " minutes ");
    }
    else if (hours > 1 && mins > 1){
    var result = (hours + " hours " + mins + " minutes ");
    }
    else if (hours > 1 && mins ==1){
    var result = (hours + " hours " + mins + " minute ");
    }
    else if (hours > 1 && mins == 0){
    var result = (hours + " hours ");
    }


    document.getElementById("countdown").innerHTML = "Order within " + result + " for delivery tomorrow.";
    }
    </script>

    Within the Onload (Developers) section of the same tab insert the following into the textbox:

    getSeconds()

    Within the code section that you want it to appear e.g. Content > Additional Content:

    <span id="countdown" style="font-weight: bold;"></span>

    Regards
    Rob
    www.bandanashop.com
    Last edited by Bandanashop; 09-02-2018 at 11:27.

  4. #4
    Join Date
    Aug 2016
    Posts
    72

    Default

    Hi Rob,

    Thank-you so much for posting and sharing your code!!


    Mike

  5. #5
    Join Date
    Jun 2012
    Location
    South West England
    Posts
    195

    Default Version 2.3 - Slightly improved

    Here is version 2.3 which resolves the issue on Friday evening where it is still promising to deliver on Saturday morning.
    There are a couple of other minor changes, if you don't like them you can comment it out by prefixing the line with the double slash e.g. '//'
    Personally, I think this should be a good improvement although I would like to A/B test it to see what the customers think.
    Regards
    Rob.

    Attached Version 2.3.txt which contains the Javascript code



    Attached Files Attached Files

  6. #6
    Join Date
    Nov 2009
    Posts
    20

    Default

    This is awesome, thanks so much Rob!

Similar Threads

  1. Request Option to change the behaviour for selecting next day carriage.
    By Jim Smith in forum Bluepark Technical Discussion
    Replies: 0
    Last Post: 09-06-2017, 09:06
  2. Countdown timer on product page? Sales conversion uplift...
    By LabelKing in forum Bluepark Technical Discussion
    Replies: 29
    Last Post: 14-08-2015, 09:01
  3. Countdown Discounts
    By Neil in forum Bluepark Technical Discussion
    Replies: 13
    Last Post: 02-04-2012, 13:56
  4. Next Day Delivery
    By OneTrue in forum Bluepark Technical Discussion
    Replies: 0
    Last Post: 21-11-2011, 12:11
  5. Next day delivery
    By StuartS in forum Bluepark Technical Discussion
    Replies: 2
    Last Post: 22-03-2010, 08:06

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us

Bluepark's ecommerce software is developed, hosted and supported exclusively by ourselves, here in the UK, and has been so since the company was initially formed in 2004. Your brand new online shop will be hosted securely on our fast and reliable server network, using a domain name of your choice, providing the ability to build and maintain your ecommerce website, and manage your orders, from any location via your own secure online Administration Console.

A Bluepark ecommerce site is the perfect tool for selling online, whether you're selling physical products, digital downloads or services. You'll be in good company with over 1,000 UK customers who also form a friendly and helpful online community, further strengthening our highly acclaimed support network.

Find us on...