Jump to content

[SOLVED] Shut store down at 9pm


Recommended Posts

Hi Nick,

In your Back Office, there is an option to enable Catalog Mode under Preferences > Products. That will prevent users from being able to add anything to their cart. I couldn't tell you the code you'll need to create in order to set it to automatically disable at 9PM each day, but I'm sure someone more experienced on the development side here on the forums could help you out with that.

 

I hope this helps.

 

-Mike

Link to comment
Share on other sites

Running this code on a cron job at 9pm and again at the time you want to open your store, will change the catalog mode. Place it in the root of your store:

<?php

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

if (!Configuration::get('PS_CATALOG_MODE')) {
Configuration::updateValue('PS_CATALOG_MODE', true);
} else {
Configuration::updateValue('PS_CATALOG_MODE', false);
}

?>

 

This is not tested because I don't have a store installed at this time. I can test it tonight at home and let you know.

Link to comment
Share on other sites

Sample cron job to run it.

1. Replace /home/mystore/public_html/ with absolute path to the root of your store to place the log file.

2. Replace http://www.mystore.com/ with the URL to your store

3. Replace 6,21 with the hours you want to open and close your store. I set to 6am and 9pm.

 

0 6,21 * * * wget -a /home/mystore/public_html/catalog_mode.txt http://www.mystore.com/catalog_mode.php -O /dev/null

Link to comment
Share on other sites

  • 1 year later...

hi,

 

i could not make this working, i think the php file described in post #5 is not working with p.s. 1.5.4.1

 

i have set correctly a test cron job with:

 

crontab -e via putty

 

and then i used for test:

 

* * * * * /usr/bin/wget http://www.mysite.com/test.php

 

<?php mail('[email protected]','Cron Job Test Script',phpversion()); ?>

 

and it worked but when i add the file copied from post#5 the cron job says it is installed correctly but nothing happens in FO, i mean the catalog mode is not activated.

Can someone help?

 

 

i have used mailto and i have received the error:

 

"HTTP request sent, awaiting response... 503 temporarily overloaded

2013-08-22 07:26:02 ERROR 503: temporarily overloaded."

Edited by sooroos (see edit history)
Link to comment
Share on other sites

×
×
  • Create New...