Jump to content
olsonsp4c

Store Mode (Open | Closed | Maintenance)

Recommended Posts

It is just VERY basic protection - it basically only checks for an @ sign and a .com, .net, .org, etc. extension...

 

but every little bit of protection from bots helps!

 

Scott

Share this post


Link to post
Share on other sites

If you want the email sent successful header message to be green instead of red, just change the following in index_maintenance.php

 

Find this:

$messageStack->add('maintenance', EMAIL_SUCCESS);

 

REPLACE with this:

 

$messageStack->add('maintenance', EMAIL_SUCCESS, 'success');

 

Thanks to Glen for the suggestion.

 

Scott

Edited by olsonsp4c

Share this post


Link to post
Share on other sites

I am very interested in this contribution. Does anyone have any screen shots so that I can take a look to see if this is what I need ?

 

I am going on vacation and so want to close my store for a week. I am wondering if it would be just worth removing the payment options in Admin so that people cant check out, and putting a note in an info box on the right column.

 

What benefit does this contribution give over my suggestion above ?

 

If anyone has screen shots, would really like to see them posted here.

 

Thanks !

Share this post


Link to post
Share on other sites

New version with screenshots and update instruction: http://addons.oscommerce.com/info/6332

 

Since v1.2

----------

* Added Maintenance Page: testing mode to temporarily disable the automatic ip detection so that you may view the index_maintenance.php page from the viewpoint of your customers for testing purposes

* Added Screenshots

 

Scott

Share this post


Link to post
Share on other sites

Thank you for the contribution update with the screen shots. I have installed the contribution on my two stores - no problems at all - everything works very well. Thank you for developing this contribution !

Share this post


Link to post
Share on other sites
Thank you for the contribution update with the screen shots. I have installed the contribution on my two stores - no problems at all - everything works very well. Thank you for developing this contribution !

 

your welcome, glad to serve...

 

Scott

Share this post


Link to post
Share on other sites

I am using STS. Am I going to run into problems when installing this? I think maintenance mode might not work correctly. Thanks for the help.

 

- Scott

Share this post


Link to post
Share on other sites

I would guess that you will run into problems... I have not toyed with the addon, so can't give a conclusive answer... this might be an opportunity for you to learn for the benefit of the whole community and post the results... thanks for using my addon.

 

Scott

Share this post


Link to post
Share on other sites

Thanks for the reply.

I wish I was skilled enough with PHP to really contribute to the development of these things.

I'll try to integrate them tonight. I'll let you know how it goes.

Share this post


Link to post
Share on other sites

Just want to thank you for a good clean contribution that was easy to install and works just fine.

 

Thanks!

Share this post


Link to post
Share on other sites

This contribution IS FANTASTIC !!!!!!!!!!!!!!!!!!!!!!!!!!!!

 

The oscommerce community owes the authors of this contribution,

 

and I for one am eternally thankfull.

 

I just installed it, seems to work perfectly except for one thing.

 

When I set in admin, the feature to ignore my admin IP address so I can see the store from my admin IP address as customers see it from theirs,

 

I seem to get locked into a session, that when I reset this feature from a different Windows XP window, then in the window I was viewing the customer version of the store in, I am just perpetually in the same mode (testing) as if I had not reset the feature in the admin from a different window.

 

I am only wondering if this is normal, or if I messed up in appying the contribution ?

 

In any event, THIS IS NOT A BIG THING !!!

 

as I can just close the window I was using to view the store from (customer view), and re-open the store in a new window, and then the store is in maintenance mode with the red warning at the top, and I can go about the operations originally intended to be done by the original contribution.

 

So, I'm not saying this may require a fix - I just want to know if I screwed up in application of the contribution.

 

Thanks again for an excellent contribution !!!

Share this post


Link to post
Share on other sites

You are both welcome.

 

I think the issue you are experiencing most likely has to do with your browser cache. You can test to see if this is the case:

 

1. Open both windows

2. Disable Testing mode in one window

3. Click around in the other window (should continue getting the maintenance page)

4. Now clear the browser cache

5. Refresh and see if you now can view your store with the red bar at the top reminding you that you are in maintenance mode

 

Scott

Share this post


Link to post
Share on other sites
my maintance page is not displaying correctly. It will redirect to the page but it is blank. Any ideas?

 

http://concept.bz/Catalog/index_maintenance.php

 

re-upload catalog/index_maintenance.php and catalog/includes/language/english/index_maintenance.php

 

make sure you defined the file properly in catalog/includes/filenames.php

 

Scott

Share this post


Link to post
Share on other sites

Hi,

 

I'm having some problems with this. I followed the text file, and copy/pasted the reqired code. I have uploaded the two files, and referenced it in filenames.php but i still cant get it to work. In the admin side there is no listing of store mode. Can someone please tell me where i might have gone wrong? i have checked that i have put the code in correctly, and i think i have.

 

Cheers

Paul.

Share this post


Link to post
Share on other sites
Hi,

 

I'm having some problems with this. I followed the text file, and copy/pasted the reqired code. I have uploaded the two files, and referenced it in filenames.php but i still cant get it to work. In the admin side there is no listing of store mode. Can someone please tell me where i might have gone wrong? i have checked that i have put the code in correctly, and i think i have.

 

Cheers

Paul.

 

You forgot to do the database inserts.

 

Scott

Share this post


Link to post
Share on other sites

Scott,

I found a minor error in index_maintenance.php. The <form> tag isn't closed. Here's the fix:

 

Find this:

	</table></td>
<!-- body_text_eof //-->

 

Replace with this:

	</table></form></td>
<!-- body_text_eof //-->

 

Most browsers probably handle it okay, so it isn't noticed except when checking the code against an HTML validator.

 

--Glen

Share this post


Link to post
Share on other sites
Scott,

I found a minor error in index_maintenance.php. The <form> tag isn't closed. Here's the fix:

 

Find this:

	</table></td>
<!-- body_text_eof //-->

 

Replace with this:

	</table></form></td>
<!-- body_text_eof //-->

 

Most browsers probably handle it okay, so it isn't noticed except when checking the code against an HTML validator.

 

--Glen

 

Thanks Glen, I'll include that in the next update!

 

Scott

Share this post


Link to post
Share on other sites

In includes/application_top.php

 

Change

// BOF: Store Mode
if (OFFLINE_IP_ADDRESS != getenv('REMOTE_ADDR')){
 if (STORE_MODE == 'Maintenance' and !strstr($PHP_SELF,MAINTENANCE_FILENAME)) {
tep_redirect(tep_href_link(MAINTENANCE_FILENAME)); }
 }
// do not let people get to down for maintenance page if not turned on
if (STORE_MODE != 'Maintenance' and strstr($PHP_SELF,MAINTENANCE_FILENAME)) {
 tep_redirect(tep_href_link(FILENAME_DEFAULT));
}
// EOF: Store Mode

 

to

 

// BOF: Store Mode
if (OFFLINE_IP_ADDRESS != getenv('REMOTE_ADDR')){
 if (STORE_MODE == 'Maintenance' and !strstr($PHP_SELF,MAINTENANCE_FILENAME)) {
header("HTTP/1.0 307 Temporary Redirect"); 
tep_redirect(tep_href_link(MAINTENANCE_FILENAME)); }
 }
// do not let people get to down for maintenance page if not turned on
if (STORE_MODE != 'Maintenance' and strstr($PHP_SELF,MAINTENANCE_FILENAME)) {
 tep_redirect(tep_href_link(FILENAME_DEFAULT));
}
// EOF: Store Mode

 

It's an SEO thing.


Hip Hop Jewelry | Bling Bling | Iced Out

Share this post


Link to post
Share on other sites

I am SO GRATEFUL you did this addon! I am getting married and need to shut the site down on my honeymoon. I tried to install, but got stuck. There is alot of changed code in my index.php. I tried to locate where in the index.php under Catalog in my site would be what to replace and I can't tell where exactly to paste your addon code.

 

This is the code in my index.php that resembles most what you have in your code to locate and add after:

 </tr>
     <tr>
       <td><table width="443" border="0" cellspacing="0" cellpadding="0">
           <tr>
             <td height="42" class="mid_tab_top_bg01"><div style="margin-left:110px;"><font class="welcome">
             <?php echo HEADING_TITLE; ?><?php
// optional Product List Filter
   if (PRODUCT_LIST_FILTER > 0) {
     if (isset($HTTP_POST_VARS['manufacturers_id'])) {
       $filterlist_sql = "select distinct c.categories_id as id, cd.categories_name as name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where p.products_status = '1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and p2c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = '" . (int)$HTTP_POST_VARS['manufacturers_id'] . "' order by cd.categories_name";
     } else {
       $filterlist_sql= "select distinct m.manufacturers_id as id, m.manufacturers_name as name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_MANUFACTURERS . " m where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and p.products_id = p2c.products_id and p2c.categories_id = '" . (int)$current_category_id . "' order by m.manufacturers_name";
     }  
   }

 

 

this is what comes directly after that code on that page in case I missed the spot to add on the code:

// Get the right image for the top-right
   $image = DIR_WS_IMAGES . 'table_background_list.gif';
   if (isset($HTTP_POST_VARS['manufacturers_id'])) {
     $image = tep_db_query("select manufacturers_image from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . (int)$HTTP_POST_VARS['manufacturers_id'] . "'");
     $image = tep_db_fetch_array($image);
     $image = $image['manufacturers_image'];
   } elseif ($current_category_id) {
     $image = tep_db_query("select categories_image from " . TABLE_CATEGORIES . " where categories_id = '" . (int)$current_category_id . "'");
     $image = tep_db_fetch_array($image);
     $image = $image['categories_image'];
   }
?>
             </font></div></td>
           </tr>
           <tr>
             <td class="middle_tab_mid"><table width="423" border="0" align="center" cellpadding="0" cellspacing="0">
                 <tr>
                   <td><?php include(DIR_WS_MODULES . FILENAME_PRODUCT_LISTING); ?></td>
                 </tr>
             </table></td>
           </tr>
           <tr>
             <td height="25" align="left" valign="top"><img src="images/middle_tab1_bottom.gif" alt="" width="443" height="14" /></td>
           </tr>
       </table></td>
       <?php

 } else { // default page

?>
     </tr>
     <tr>
       <td>


	<table border="0" width="443" cellspacing="0" cellpadding="0">
           <tr>
             <td class="main"><?php include(DIR_WS_LANGUAGES . $language . '/' . FILENAME_DEFINE_MAINPAGE); ?></td>
           </tr>
           <tr>
             <td>

		  	<?php //include(DIR_WS_MODULES . FILENAME_NEW_PRODUCTS); ?>



           <?php

  include(DIR_WS_MODULES . FILENAME_UPCOMING_PRODUCTS);

?>
      </td>
           </tr>   </table></td>
       <?php

 }

?>
     </tr>
   </table></td>
   <td width="222" align="left" valign="top">
<table border="0" cellspacing="0" cellpadding="2">

		<tr><td> <!-- right_navigation //-->
           <?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
           <!-- right_navigation_eof //-->
		</td></tr>
     </table>

</td>
 </tr>
</table>
<!-- body //-->
<!-- body_eof //-->
<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->

</body>

</html>

<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

Please advise. and THANK YOU in advance. :)

Share this post


Link to post
Share on other sites

Without looking at your file, I think that you should put it after this:

/ Get the right image for the top-right
$image = DIR_WS_IMAGES . 'table_background_list.gif';
if (isset($HTTP_POST_VARS['manufacturers_id'])) {
$image = tep_db_query("select manufacturers_image from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . (int)$HTTP_POST_VARS['manufacturers_id'] . "'");
$image = tep_db_fetch_array($image);
$image = $image['manufacturers_image'];
} elseif ($current_category_id) {
$image = tep_db_query("select categories_image from " . TABLE_CATEGORIES . " where categories_id = '" . (int)$current_category_id . "'");
$image = tep_db_fetch_array($image);
$image = $image['categories_image'];
}
?>
</font></div></td>
</tr>

 

Scott

Share this post


Link to post
Share on other sites

Thanks Scott.

I installed it very carefully.

 

I went into Admin and I don't see it. I see the Store Online: true/false part but I don't see the Store mode to change to maintenance, etc.

I looked everywhere in Admin section.

Please advise. What didn't I do?

 

In gratitude,

Li

Share this post


Link to post
Share on other sites

you must not have inserted the "store_mode.sql" into your database... that's my guess.

 

Scott

Share this post


Link to post
Share on other sites

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

×