Jump to content

[SOLVED]How to define store opening times in order to only accept order during those periods.


lpfernandes

Recommended Posts

The reason behind the question is that the shop is a restaurant take away, and during closing times customers should not be able to place orders. The ideal solution in fact would be to have some added options when the customers place the order to select when they want their order to be delivered (date and time), since this seems more complicated I thought that the shop could simply close during closing times. The solution I have now implemented is to use the maintenance mode to work as if the shop is closed.

Link to comment
Share on other sites

PrestaShop v1.4 has a "Date of delivery" module that lets the customer specify when they want their order delivered. I think it relies on hooks added to v1.4 though, so it won't work in v1.3.2.

Until v1.4 is released, the only solution I can think of is to write a cron script that automatically puts the website into maintenance mode. I don't have time to come up with a proper solution, but a file called shop_enable.php in the root directory with something like the following should work:

<?php

include(dirname(__FILE__).'/config/config.inc.php');

if ($_GET['password'] == 'password')
  Db::getInstance()->execute("UPDATE `"._DB_PREFIX_."configuration` SET `value` = 1 WHERE `name` = 'PS_SHOP_ENABLE'");

?>



and a file called shop_disable.php with the following:

<?php

include(dirname(__FILE__).'/config/config.inc.php');

if ($_GET['password'] == 'password')
  Db::getInstance()->execute("UPDATE `"._DB_PREFIX_."configuration` SET `value` = 0 WHERE `name` = 'PS_SHOP_ENABLE'");

?>



Change the second 'password' to a password to prevent anyone but yourself running the script, then create a cron job in your cPanel to execute shop_disable.php?password=password when you want the shop to close and another cron job to execute shop_enable.php?password=password when you want the shop to open.

Link to comment
Share on other sites

  • 8 months later...

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...