Jump to content

custom message


Recommended Posts

Hello forum guys!
I have just added a script in the file cart.php for checking the work time for the shop and allows/disallows to the customers to place orders.
The idea is when the staff are not there, the system rejects the orders.
I put a message when the customers click on add to cart, to tell them that they can't order right now.
The message is shown on every page load, and by clicking the link.
I want to make it work only by clicking on that link, not on page load.
Thanks in advance!

// worktime
$workday = date("N");
$workhour = date("G");
if( ($workday >= 1) && ($workday <= 5) && ($workhour >= 12) && ($workhour <= 21)){
// presta add to cart string
$add = Tools::getIsset('add') ? 1 : 0;
}
else {
   if( ($workday == 6) && ($workhour >= 10) && ($workhour <= 13) ){
// presta add to cart string
$add = Tools::getIsset('add') ? 1 : 0;  
}
   else
    $errors[] = Tools::displayError(‘shop don’t work now!’);
  }

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...