Page 1 of 2

[CONTRIB] Maintenance Mode

Posted: Fri Oct 30, 2009 1:52 am
by Qphoria
This is another free one as I think it should be part of OpenCart.
Supported OpenCart Versions:
================
v1.2.6, v1.2.7, v1.2.8, v1.2.9, v1.3.0, v1.3.1, v1.3.2, v1.3.3, v1.3.4, v1.4.0, v1.4.4


What does it do:
================
This contrib adds a maintenance mode option to your admin->configuration->settings page.


Main features:
==============
* Uses the preAction system to check maintenance status to protect all pages
* Admin can still see the store normally when logged into the admin section.
* Maintenance page uses its own tpl file for extended customizations
catalog_maintmode.jpg

catalog_maintmode.jpg (42.08 KiB) Viewed 18084 times

-- UPDATED TO SUPPORT up to v1.4.4

Re: [CONTRIB] Maintenance Mode

Posted: Tue Nov 03, 2009 12:46 pm
by digitalchaos
Thanks Q this was definitely needed

Re: [CONTRIB] Maintenance Mode

Posted: Wed Nov 04, 2009 8:16 pm
by DannyMacD
works a treat! thanks Q!

Re: [CONTRIB] Maintenance Mode

Posted: Thu Nov 12, 2009 3:59 am
by i2Paq
Great MOD, this shoul be added to the next version.

Re: [CONTRIB] Maintenance Mode

Posted: Thu Nov 12, 2009 11:43 am
by Qphoria
Updated file in original post with v1.3.3/1.3.4 support
Now there are 2 versions inside the zip. a v132 and v133-v134.
Choose the version that matches your install

Re: [CONTRIB] Maintenance Mode

Posted: Thu Nov 12, 2009 5:25 pm
by leprimo
GREAT! 8) 8) Thank you.

Re: [CONTRIB] Maintenance Mode

Posted: Wed Dec 02, 2009 1:20 pm
by miki-dan
It's a masterpiece maestro! Romania is thanking you personaly for this.

Re: [CONTRIB] Maintenance Mode

Posted: Sat Dec 12, 2009 9:02 pm
by dbstr
Theodore wrote:hi, sorry, i installed this, i start maintance mode in admin settings.. but do not see chenges :(
Most likely because you are logged in as admin. Try logging out, and refresh the frontend store.

Re: [CONTRIB] Maintenance Mode

Posted: Sat Jan 02, 2010 7:38 pm
by axxies
Great mod - I love it!

Re: [CONTRIB] Maintenance Mode

Posted: Mon Feb 08, 2010 10:26 am
by The Alchemist
You know what what be a good mod for this?

If you have maintenance mode for only certain parts of the site, like Products, information, PDF's, etc, so that this way the whole site isnt down at one time.

I have this mod as well, and think its cool, but sometimes I am only working on one section at a time, and dont need the whole site down to work out the bugs.

Re: [CONTRIB] Maintenance Mode

Posted: Wed Mar 24, 2010 10:34 pm
by Qphoria
Updated for 1.4.0 through 1.4.4 support

Fixed:
- Skip Maintenance mode if using SEO
- blank page if there is no index.php on the end of the url.

Re: [CONTRIB] Maintenance Mode

Posted: Thu Mar 25, 2010 2:28 am
by Wade C
Tried installing this on 1.4.4
Once installed, when I go to the System-Settings page, I get
//Q: Maintenance Mode $_['entry_maintenance'] = 'Maintenance Mode:
Prevents customers from browsing your store. They will instead see a maintenance message. Only users logged in as admin will see the store as normal.';

Showing up at the top above the OpenCart | Adminstration header
Then when I go to the "Server" Tab and select the "yes" radio button for "entry_maintenance" - and click save, I get:
//Q: Maintenance Mode $_['entry_maintenance'] = 'Maintenance Mode:
Prevents customers from browsing your store. They will instead see a maintenance message. Only users logged in as admin will see the store as normal.';Warning: Cannot modify header information - headers already sent by (output started at /usr/local/4admin/apache/vhosts/website.com/httpdocs/cartfolder/admin/language/english/setting/setting.php:50) in /usr/local/4admin/apache/vhosts/website.com/httpdocs/cartfolder/system/engine/controller.php on line 27

Did I put something in the wrong place? I went through the instructions a few times double checking myself.

Thanks
Wade

Re: [CONTRIB] Maintenance Mode

Posted: Thu Mar 25, 2010 9:39 am
by migz
Qphoria wrote:Updated for 1.4.0 through 1.4.4 support

Fixed:
- Skip Maintenance mode if using SEO
- blank page if there is no index.php on the end of the url.
still the same on 1.4.0, what are the changes so it wouldn't skip SEO?

Re: [CONTRIB] Maintenance Mode

Posted: Thu Mar 25, 2010 12:14 pm
by Qphoria
just move the preaction in the index above the seo one. The readme says above now

Re: [CONTRIB] Maintenance Mode

Posted: Thu Mar 25, 2010 9:31 pm
by Qphoria
carefully read step 4. I think you are editing the setting.tpl file of step b but you need to be editing the file in step a

Re: [CONTRIB] Maintenance Mode

Posted: Thu Mar 25, 2010 10:45 pm
by migz
Qphoria wrote:just move the preaction in the index above the seo one. The readme says above now
thanks! O0

Re: [CONTRIB] Maintenance Mode

Posted: Thu Mar 25, 2010 11:44 pm
by Wade C
Here is a clip from /admin/controller/setting/setting.php (step 4)

Code: Select all

if (isset($this->request->post['config_error_filename'])) {
			$this->data['config_error_filename'] = $this->request->post['config_error_filename']; 
		} else {
			$this->data['config_error_filename'] = $this->config->get('config_error_filename');
		}
		 
//Q: Maintenance Mode
		$this->data['entry_maintenance'] = $this->language->get('entry_maintenance');
		if (isset($this->request->post['config_maintenance'])) {
		    $this->data['config_maintenance'] = $this->request->post['config_maintenance']; 
		} else {
		    $this->data['config_maintenance'] = $this->config->get('config_maintenance');
		}//




		$this->template = 'setting/setting.tpl';
		$this->children = array(
			'common/header',	
			'common/footer'	
		);


...from /admin/language/english/setting/setting.php (step 5)

Code: Select all

// Error
$_['error_permission']        = 'Warning: You do not have permission to modify settings!';
$_['error_title']             = 'Title must be greater than 3 and less than 32 characters!';
$_['error_owner']             = 'Store Owner must be greater than 3 and less than 64 characters!';
$_['error_address']           = 'Store Address must be greater than 10 and less than 256 characters!';
$_['error_email']             = 'E-Mail Address does not appear to be valid!';
$_['error_telephone']         = 'Telephone must be greater than 3 and less than 32 characters!';
$_['error_error_filename']    = 'Error Log Filename required!';
?>
//Q: Maintenance Mode
$_['entry_maintenance']          = 'Maintenance Mode:<br /><span class="help">Prevents customers from browsing your store. They will instead see a maintenance message. Only users logged in as admin will see the store as normal.</span>';

And this is a chunk from /admin/view/template/setting/setting.tpl (step 6)

Code: Select all

 <tr>
            <td><span class="required">*</span> <?php echo $entry_error_filename; ?></td>
            <td><input type="text" name="config_error_filename" value="<?php echo $config_error_filename; ?>" />
              <?php if ($error_error_filename) { ?>
              <span class="error"><?php echo $error_error_filename; ?></span>
              <?php } ?></td>
          </tr>
<!--//Q: BOF Maintenance Mode-->
          <tr>
            <td><?php echo $entry_maintenance; ?></td>
            <td><?php if ($config_maintenance) { ?>
              <input type="radio" name="config_maintenance" value="1" checked="checked" />
              <?php echo $text_yes; ?>
              <input type="radio" name="config_maintenance" value="0" />
              <?php echo $text_no; ?>
              <?php } else { ?>
              <input type="radio" name="config_maintenance" value="1" />
              <?php echo $text_yes; ?>
              <input type="radio" name="config_maintenance" value="0" checked="checked" />
              <?php echo $text_no; ?>
              <?php } ?></td>
          </tr>
          <!--//Q: EOF Maintenance Mode-->        
	  </table>
      </div>
    </form>
I can send you copies of the entire files if you wanted to look at them.

I think I did everything right... When I read youre reply, I thought.... "ooooooohhhhhh I bet I did" but when I got to checking, there isnt a .tpl file in that folder and Im not finding a setting.tpl in any "route" that I would have thought Id have mistakenly taken (ie following a wrong line to a folder) - but who knows. Im still learning A LOT about this stuff.

Any thoughts would be appreciated. I hope I have included enough info, and not proven myself as a proof-reading idiot.
Wade

Re: [CONTRIB] Maintenance Mode

Posted: Fri Mar 26, 2010 12:19 am
by Qphoria
You pasted the language stuff AFTER the ?>. needs to be before.

Re: [CONTRIB] Maintenance Mode

Posted: Fri Mar 26, 2010 12:42 am
by Wade C
:-\

Bingo!

Ahhh I followed directions "too well" and with my lack of coding knowledge, it bit me. :D

Thanks so much! Im still learning and I appreciate your patience with me.

Wade

Re: [CONTRIB] Maintenance Mode

Posted: Sun Apr 18, 2010 2:21 am
by sizzlingscience
Hi there

I've installed the MOD but my maintenance page isn't showing too well - any suggestions? I'm running version 1.4.0
http://www.sizzlingscience.co.uk/opencarttest/

Thanks, Melanie