Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Support] Simple Down for Maintenance


Guest

Recommended Posts

Author: Jared Call

Date: 30 December, 2005

 

Support for this contribution is provided at the following URL: http://www.oscommerce.com/forums/index.php?showtopic=187311

This contribution can be downloaded from: http://www.oscommerce.com/community/contributions,3902

 

 

What this contribution does:

============================

 

This contribution is a simple way to allow a store administrator to administratively "down" the store temporarily. Yes, there are a few other contribs that provide this feature, but they either didn't have the features I wanted or were more of a pain than seemed necessary.

 

Features:

1 - Simple installation: 2 minor file edits, 1 file copy, a few SQL statements.

2 - Administrative on/off for "Downing" the store

3 - Admin-configurable warning message (also on/off) (not timed) to avoid surprising customers by "downing" the store suddently

4 - Admin IP address exception - - you can enter in your IP address to still browse the store while everyone else sees it as "down"

Edited by jcall
Link to comment
Share on other sites

  • 2 weeks later...

I keep getting an error saying that The redirect limmit for this page has been exceeded. Any Idea why I get this error, I remove your contrib and every thing goes back to normal.

 

I get this error when I have the page set as down for maint.

 

www.jagged-jewelry.ca

Link to comment
Share on other sites

  • 1 month later...

I was pointed to this contribution because I was looking to a similar script. Perhaps you can help me with this.

 

My friend is a caterer, providing people with sandwiches, breadspread, warm meals, ... and he wants this online shop so people can order from home, so he can deliver the food. But he only wants the people to take orders from 00AM till 10AM, because he needs to prepare the food orders, and do deliveries.

 

So the shop needs to be closed daily after 10AM.

 

Is there a way to do this with this contribution or with some adaptations ?

thanks,

 

Sixten

Link to comment
Share on other sites

  • 3 weeks later...

The switch to down the store is just a database setting. Here is one way to do what you want:

 

1) take the following SQL statement, save it as a text file named close-store.sql:

update configuration set configuration_value = 'true' where configuration_key = 'DOWN_FOR_MAINTENANCE'

 

2) save the following SQL statement as a text file named open-store.sql:

update configuration set configuration_value = 'false' where configuration_key = 'DOWN_FOR_MAINTENANCE'

 

3) create cron jobs to run those SQL statements using the mysql command line tool (search Google for mysql database import if you don't know how to do this).

 

Done!

 

-jared

Link to comment
Share on other sites

  • 2 months later...

Hello. This contrib is exactly what I was looking for.

 

I'm using STS and immediately ran into the problem with this contrib and STS. I also looked at the 4/19/06 addition by betacodehex to fix this issue. I think I have a simpler way and would like to see what you think.

 

In includes/header.php, instead of inserting the PHP wrapped HTML, why not add the DOWN_FOR_MAINTENANCE_MESSAGE to the list of warnings that are already built into OSC? Here's the code I use to do that. This appears to work with and without STS.

 

Add

  if (DOWN_FOR_MAINTENANCE_WARNING == 'true') {
  $messageStack->add('header', DOWN_FOR_MAINTENANCE_MESSAGE, 'warning');
 }

 

just after the last Warning check. Below is what it should look like after you're done. I've snipped out extra code to shorten the listing.

 

// check if the 'install' directory exists, and warn of its existence
...snip...
// check if the configure.php file is writeable
...snip...
// check if the session folder is writeable
...snip...
// check session.auto_start is disabled
...snip...

 if ( (WARN_DOWNLOAD_DIRECTORY_NOT_READABLE == 'true') && (DOWNLOAD_ENABLED == 'true') ) {
if (!is_dir(DIR_FS_DOWNLOAD)) {
  $messageStack->add('header', WARNING_DOWNLOAD_DIRECTORY_NON_EXISTENT, 'warning');
}
 }

 if (DOWN_FOR_MAINTENANCE_WARNING == 'true') {
  $messageStack->add('header', DOWN_FOR_MAINTENANCE_MESSAGE, 'warning');
 }

 if ($messageStack->size('header') > 0) {
echo $messageStack->output('header');
 }

 

 

Thoughts?

 

 

Also, it would be helpful if the SQL was also included in a .sql file inside the contrib. I know it's not required but would be helpful to run it all at once.

 

Thanks

Nathan

Link to comment
Share on other sites

  • 1 year later...

I like this mod, and would like to keep it installed.

When I attempt to login with and without down = true i get the following error

 

Warning: Cannot modify header information - headers already sent by (output started at /home/xxxxx/public_html/product/includes/application_top.php:1090) in /home/xxxxx/public_html/product/includes/functions/general.php on line 33

 

And can not do any thing else.

 

How do I fix this?

 

Thanks

Link to comment
Share on other sites

  • 5 months later...

I've uploaded a variant of the code. It will compare a definded session id instead of the admins IP address. This is useful for folks using "shared SSL certificate" provided by mass hosters (e.g. Hosteurope, 1und1, Strato a.s.o.).

 

Furthermore, the suggested warning message of Nathan Robertson is included. I've dropped also an SQL statement in order to provide german language.

 

Contribution: Simple Down For Maintenance

 

Please comment!

 

Black Jack 21

Link to comment
Share on other sites

  • 1 month later...

Hello, i have been looking for something like this and come accross here. Now i am getting stuck just at the first stage.

 

Running the SQL statement. Keeps bringing up error messages??

 

e.g. error of the statement:

 

Error

SQL query:

 

INSERT INTO configuration_group( configuration_group_id, configuration_group_title, configuration_group_description, sort_order, visible )

VALUES ( 8675312, 'Down for Maintenance', 'Down for Maintenance', '901', '1' ) ;

 

 

 

MySQL said:

 

#1062 - Duplicate entry '8675312' for key 1

 

 

and this is what i ran in the SQL:

 

INSERT INTO configuration_group (configuration_group_id, configuration_group_title, configuration_group_description, sort_order, visible) VALUES (8675312, 'Down for Maintenance', 'Down for Maintenance', '901', '1');

 

INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Down the store for maintenance?', 'DOWN_FOR_MAINTENANCE', 'false', 'If enabled, all requests for catalog pages will be redirected to the maintenance page.', 8675312, '', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now());

 

INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Maintenance page', 'DOWN_FOR_MAINTENANCE_PAGE', 'index-maint.php', 'Page to which users will be redirected while store is down for maintenance. A good idea would be to create a new HTML or PHP page which matches your store layout, but with all the content replaced by a maintenance message.', 8675312, '', now());

 

INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Enable Warning?', 'DOWN_FOR_MAINTENANCE_WARNING', 'false', 'If enabled, a banner will display at the top of each catalog page warning your customers that the store will be down for maintenance soon.', 8675312, '', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now());

 

INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Warning Message', 'DOWN_FOR_MAINTENANCE_MESSAGE', 'The store will be going down for maintenance in a few minutes. We apologize for the inconvience.', 'This is the message customers will see when the Warning Message is enabled,', 8675312, '', 'tep_cfg_textarea(', now());

 

 

INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Admin IP Address', 'DOWN_FOR_MAINTENANCE_IP_ADDRESS', '127.0.0.1', 'This IP address will still be able to access the site while everyone else gets redirected to the Down For Maintenance page.<br><br>You can see the current IP address of your PC at http://whatismyipaddress.com.', 8675312, '', now());

 

The store will be going down for maintenance in a few minutes. We apologize for the inconvience.

 

I Then ran it without the "The store will be going down for maintenance in a few minutes. We apologize for the inconvience." and still didnt work???

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...