{"id":258,"date":"2010-07-25T15:46:08","date_gmt":"2010-07-25T23:46:08","guid":{"rendered":"https:\/\/www.numinix.com\/blog\/?p=258"},"modified":"2019-05-29T10:38:20","modified_gmt":"2019-05-29T17:38:20","slug":"how-to-put-only-specific-zen-cart-pages-down-for-maintenance","status":"publish","type":"post","link":"https:\/\/www.numinix.com\/blog\/how-to-put-only-specific-zen-cart-pages-down-for-maintenance\/","title":{"rendered":"How to put only specific Zen Cart pages down for maintenance"},"content":{"rendered":"<p>Whenever you can, you should be using a development installation to test and make changes to your website before moving the modifications to your live store.\u00a0 However, if for some reason you absolutely must work on your live store, you may want to put only the area of the website you are working on down for maintenance.<\/p>\n<p>If you have used the module Fast and Easy AJAX Checkout, it is already possible to place the checkout down for maintenance while leaving the rest of your website open to the public.\u00a0 But what about other pages?\u00a0 It would be time consuming to place each page down individually using the same method we used in the FEAC module.\u00a0 Luckily, we&#8217;ve implemented a simple method with only one core file change and one configuration setting added to the admin.<\/p>\n<p>Firstly, patch your database with the following code:<\/p>\n<pre lang=\"sql\" escaped=\"true\">INSERT INTO configuration ( `configuration_id` , `configuration_title` , `configuration_key` , `configuration_value` , `configuration_description` , `configuration_group_id` , `sort_order` , `last_modified` , `date_added` , `use_function` , `set_function` ) VALUES\r\n(NULL , 'Maintenance Pages', 'DOWN_FOR_MAINTENANCE_PAGES', '', 'Enter the define page names separated by commas without spaces (i.e. blog,checkout_shipping,checkout_payment)', '20', '99', '', now(), NULL , NULL);<\/pre>\n<p>Next open the file \/includes\/init_includes\/init_customer_auth.php and find:<\/p>\n<pre lang=\"php\" line=\"29\" escaped=\"true\">if (DOWN_FOR_MAINTENANCE == 'true') {\r\n  if (!strstr(EXCLUDE_ADMIN_IP_FOR_MAINTENANCE, $_SERVER['REMOTE_ADDR'])){\r\n    if ($_GET['main_page'] != DOWN_FOR_MAINTENANCE_FILENAME) $down_for_maint_flag = true;\r\n  }\r\n}<\/pre>\n<p>And replace it with:<\/p>\n<pre lang=\"php\" escaped=\"true\">if (DOWN_FOR_MAINTENANCE == 'true') {\r\n  if (!strstr(EXCLUDE_ADMIN_IP_FOR_MAINTENANCE, $_SERVER['REMOTE_ADDR'])){\r\n    if (defined('DOWN_FOR_MAINTENANCE_PAGES') &amp;&amp; DOWN_FOR_MAINTENANCE_PAGES != '') {\r\n      $maintenance_pages = explode(',', DOWN_FOR_MAINTENANCE_PAGES);\r\n      if (in_array($_GET['main_page'], $maintenance_pages)) $down_for_maint_flag = true;\r\n    } else {\r\n      if ($_GET['main_page'] != DOWN_FOR_MAINTENANCE_FILENAME) $down_for_maint_flag = true;\r\n    }\r\n  }\r\n}<\/pre>\n<p>Note: The site will show a down for maintenance message to the admin if an IP address is specified.  For all other customers, they will see the site as usual.<\/p>\n<p><script type=\"application\/ld+json\">\n      {\n        \"@context\": \"http:\/\/schema.org\",\n        \"@type\": \"NewsArticle\",\n\t\"dateModified\": \"https:\/\/calendar.google.com\/calendar\/r\/day\/2019\/5\/29\",\n\t\"mainEntityOfPage\": \"https:\/\/www.numinix.com\/wordpress\/2010\/07\/25\/how-to-put-only-specific-zen-cart-pages-down-for-maintenance\/\",\n\"author\": {\n    \"@type\": \"Person\",\n    \"name\": \"Jeff Lew\"\n  },\n   \"publisher\": {\n    \"@type\": \"Organization\",\n    \"name\": \"Numinix Web Developers\",\n    \"logo\": {\n      \"@type\": \"ImageObject\",\n      \"url\": \"https:\/\/www.numinix.com\/images\/banner_hero_clarity.png\"\n    }\n    },\n        \"headline\": \"How to put only specific Zen Cart pages down for maintenance\",\n        \"datePublished\": \"2010-07-25T16:00:41Z\",\n        \"image\": [\n          \"https:\/\/media.licdn.com\/dms\/image\/C560BAQFjWJ-r6HLAfQ\/company-logo_200_200\/0?e=2159024400&v=beta&t=KzCK1BdfCM48zSzjZ6lsxOsr7sfO0_EVarvyFHWW6H8\"\n        ]\n      }\n    <\/script><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Whenever you can, you should be using a development installation to test and make changes to your website before moving the modifications to your live store.\u00a0 However, if for some reason you absolutely must work on your live store, you may want to put only the area of the website you are working on down&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_lmt_disableupdate":"","_lmt_disable":"","_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[142,3],"tags":[140,141,139,143,8],"class_list":["post-258","post","type-post","status-publish","format-standard","hentry","category-tutorials","category-zen-cart-optimization","tag-define-pages","tag-development","tag-maintenance","tag-tutorial","tag-zen-cart"],"modified_by":"Numinix Developer","jetpack_featured_media_url":"","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.numinix.com\/blog\/wp-json\/wp\/v2\/posts\/258","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.numinix.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.numinix.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.numinix.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.numinix.com\/blog\/wp-json\/wp\/v2\/comments?post=258"}],"version-history":[{"count":0,"href":"https:\/\/www.numinix.com\/blog\/wp-json\/wp\/v2\/posts\/258\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.numinix.com\/blog\/wp-json\/wp\/v2\/media?parent=258"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.numinix.com\/blog\/wp-json\/wp\/v2\/categories?post=258"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.numinix.com\/blog\/wp-json\/wp\/v2\/tags?post=258"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}