AbanteCart Community

AbanteCart Development => New Features Discussion => Topic started by: CTGO.co on February 02, 2019, 04:36:59 AM

Title: maintenance Timer
Post by: CTGO.co on February 02, 2019, 04:36:59 AM

I have suggestion about adding timer to the maintenance, I don't have idea hot to be this function in the main code but I added manual html code to a block in the maintenance. The code looks like this:

<meta name="viewport" content="width=device-width, initial-scale=1">
p {
  text-align: center;
  font-size: 100px;
  margin-top: 100px;

<p id="demo"></p>

// Set the date we're counting down to
var countDownDate = new Date("Feb 1, 2019 15:30:00").getTime();

// Update the count down every 1 second
var x = setInterval(function() {

    // Get todays date and time
    var now = new Date().getTime();
    // Find the distance between now and the count down date
    var distance = countDownDate - now;
    // Time calculations for days, hours, minutes and seconds
    var days = Math.floor(distance / (1000 * 60 * 60 * 24));
    var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
    var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
    var seconds = Math.floor((distance % (1000 * 60)) / 1000);
    // Output the result in an element with id="demo"
    document.getElementById("demo").innerHTML = days + "d " + hours + "h "
    + minutes + "m " + seconds + "s ";
    // If the count down is over, write some text
    if (distance < 0) {
        document.getElementById("demo").innerHTML = "EXPIRED";
}, 1000);


I think its gonna be good to add Automatic Timer to maintenance function which will stop maintenance automatically. 

Title: Re: maintenance Timer
Post by: llegrand on February 02, 2019, 08:57:15 AM
IMO  that is quite unnecessary and perhaps even a disaster in the making - When the admin  is finished with the process that required mtce mode that would be the correct time to take it off mtce.   What if your automatic time turned it back on in the middle of some updating that you weren't finished with?
Automation is useful for a lot of processes,  but some should be left to be manually executed when it is the correct time to do so. 

Again  this is my opinion.
Title: Re: maintenance Timer
Post by: abantecart on February 02, 2019, 09:14:39 PM
Thank you for suggestion. I would have to agree with llegrand. Automation is great, but in this case, we can not be certain that user want to disable maintenance mode.
We can add a setting to enable or disable this automatic mode, but I am not sure how useful this will be.
Title: Re: maintenance Timer
Post by: CTGO.co on February 04, 2019, 02:39:16 AM
hi guys!

Thanks for you opinions and comments, however the function gonna be good at least when visitors would wanna do process of shopping on website and see that there is a maintenance period they can arrange the next visit to start the shopping time. otherwise, the admin of website at least he can guises the required time for his maintenance process too.

Title: Re: maintenance Timer
Post by: llegrand on February 04, 2019, 08:47:07 AM
ah and now there is clarity of what you want to do-  you're not asking for the mtce to be automatically turned back on -  but for the mtce display page to give site visitors a time when the site will be back.

You're request for a return time  makes more sense now.