Jump to content

Request: Maintenance information


Recommended Posts

Hello!

I run the shop myself, and only by myself. Sometimes I need to go away from home for more than 1-2 days, and by then I close the shop because I want to give best service possible and not let customers wait for me to process their orders.

I would love to have a text box on same page as the radio button option for entering shop into maintenance mode. There I can enter text on reason of why the shop is down. And by then the front page will show the text I have entered.

I would also use it to write that I am adding stuff to shop.
So people would know that it would just be down for a few minutes. Or it would be down for many days when I am gone.

I do really not want to have to edit the file every time.

Thanks for consideration :)

Link to comment
Share on other sites

The best way would be to make it configurable.

To add a field on the Preferences tab for the message, in AdminPreferences,php, after this line:

'PS_MAINTENANCE_IP' => array('title' => $this->l('Maintenance IP:'), 'desc' => $this->l('IP addresses allowed to access the Front Office even if shop is disabled. Use coma to separate them (e.g., 42.24.4.2,127.0.0.1,99.98.97.96)'), 'validation' => 'isGenericName', 'type' => 'text', 'size' => 15, 'default' => ''),



Add This line:

'PS_MAINTENANCE_MSG' => array('title' => $this->l('Maintenance Message:'), 'desc' => $this->l('Message to show on the Front Office when shop is disabled.'), 'validation' => 'isGenericName', 'type' => 'text', 'size' => 100, 'default' => ''),



This will let you specify the message you want to use when the shop is down.

Now, in maintenance.tpl, in your theme, change this line:

{l s='In order to perform site maintenance, our online shop has been taken offline temporarily. We apologize for the inconvenience, and ask that you please try again later !'}



to this:

{l s=$maintenance_msg}



Now, you also have to set the $maintenance_msg smarty variable, and you do it in init.php:
Add this line:

$smarty->assign('maintenance_msg', Configuration::get('PS_MAINTENANCE_MSG'));



right after this line, around line 211

header('HTTP/1.1 503 temporarily overloaded');

Link to comment
Share on other sites

×
×
  • Create New...