♥raiwa Posted December 1, 2016 Share Posted December 1, 2016 (edited) Store Mode BS Complete recoded Add-On, 100% modularized, not any file changes.Inspired by:Store Mode (Open | Closed | Maintenance)and:Site Maintenance Status - All versionsMaintenance page based on the page included there. Thanks to @@Demitry Installation: Upload new files and install one ht module and one content header module.How it worksThis add-on allows to switch your store to different closed/maintenance modes. It allows you to do installations, maintenance and checks, closing only the strict necessary areas of your store.Store modes: Online:Normal store mode Custom:Customizable group of pages. Default: product_reviews.php and product_reviews_write.php.Any group of pages can be defined. Customers will be redirected to the last visited page outside the restricted area or index.php.A temporary message will be shown only if a customer tries to access the restircted area. Checkout:By default all checkout pages are included in this group. Customers will be redirected to the last visited page outside the restricted area or shopping_cart.php.A permanent message will be shown on the shopping cart page and optional on the index page. An additional temporary message shows only if a customer tries to access the restircted area. Account:By default all checkout pages and account pages are included in this group. Customers will be redirected to the last visited page outside the restricted area or index.php.A permanent message will be shown on the shopping cart page and index page. An additional temporary message shows only if a customer tries to access the restircted area.Logged in customers will be logged off. Offline:Customers will be redirected by .htaccess rewrite rules to a standalone 503 maintenance page.The store administrators IP will be entered automatically in a configuration list. Additional administrators/developpers IPs can be added.These IPs are excluded from redirects in all the above listed Modes.Test Modes for all above listed modes are available which will only redirect the IP's included in the configuration list. This can be used to check the redirects and messages. Please give it a try for beta tests. Any error reports and suggestions are very welcome. Thanks and kind regards Rainer Edited December 1, 2016 by raiwa ecommunlimited, Fiber and frankl 3 Quote About Me: http://www.oscommerce.com/forums/user/249059-raiwa/ Need help? How To Get The Help You Need Is your version of osC up to date? You'll find the latest osC community version CE Phoenix here. Public Phoenix Change Log Cheat Set on Google Sheets Link to comment Share on other sites More sharing options...
♥raiwa Posted December 2, 2016 Author Share Posted December 2, 2016 (edited) To Do List: - move message "You have been logged off..." out of the permanent account message and show only if customer has been logged off. - add "Offline time left...." message to maintenance page - add installation checks to modules - spanish and german language translations Edited December 2, 2016 by raiwa Quote About Me: http://www.oscommerce.com/forums/user/249059-raiwa/ Need help? How To Get The Help You Need Is your version of osC up to date? You'll find the latest osC community version CE Phoenix here. Public Phoenix Change Log Cheat Set on Google Sheets Link to comment Share on other sites More sharing options...
♥raiwa Posted December 4, 2016 Author Share Posted December 4, 2016 (edited) Hello, 8 downloads, not any feedback after 4 days, seems you are all very occupied with christmas business :- :thumbsup: Here the final beta2. Changes: - separate "log off customer" option - move message "You have been logged off..." out of the permanent account message and show only if customer has been logged off. - add "Offline time left...." message to maintenance page - add installation checks to modules - spanish and german language translations - restore .htaccess by removing the rewrite rules instead to restore the backup. This allows also to work on the -htaccess file without manual post operations. I'll await a couple of days more for feedback, then upload to add-ons! rgds Rainer Edited December 4, 2016 by raiwa Quote About Me: http://www.oscommerce.com/forums/user/249059-raiwa/ Need help? How To Get The Help You Need Is your version of osC up to date? You'll find the latest osC community version CE Phoenix here. Public Phoenix Change Log Cheat Set on Google Sheets Link to comment Share on other sites More sharing options...
frankl Posted December 4, 2016 Share Posted December 4, 2016 @@raiwa I'm not at work until (my) Wednesday, I will check it then. raiwa 1 Quote osCommerce user since 2003! Link to comment Share on other sites More sharing options...
♥raiwa Posted December 4, 2016 Author Share Posted December 4, 2016 @@frankl thank you Quote About Me: http://www.oscommerce.com/forums/user/249059-raiwa/ Need help? How To Get The Help You Need Is your version of osC up to date? You'll find the latest osC community version CE Phoenix here. Public Phoenix Change Log Cheat Set on Google Sheets Link to comment Share on other sites More sharing options...
ecommunlimited Posted December 5, 2016 Share Posted December 5, 2016 @@raiwa For your second beta version: The link to install in includes/modules/content/header/cm_header_store_mode.php didn't work.https://mystore.com/my-admin/modules_content.php?action=configure&module=cm_header_store_mode#section_headerI had to use my button.https://mystore.com/my-admin/modules.php?set=header_tags&module=ht_store_mode&action=installThe includes/modules/header_tags/ht_store_mode.php wouldn't install. Kept giving me a 500 Internal ErrorThe ht_store_mode.php from your first version installed just fine.https://mystore.com/my-admin/modules.php?set=header_tags&module=ht_store_mode Take care Bill Quote Link to comment Share on other sites More sharing options...
ecommunlimited Posted December 5, 2016 Share Posted December 5, 2016 @@raiwa I forgot to mention the beta2 stops Twitter Typeahead Autocomplete Search from working. Take care Bill Quote Link to comment Share on other sites More sharing options...
♥raiwa Posted December 5, 2016 Author Share Posted December 5, 2016 (edited) Hello Bill @@ecommunlimited, I checked this and couldnt reproduce any of the errors you report.I checked in local installations with 3 different edge versions and gold and under php5.4-7.Also in 2 different edge server installations. The link to install in includes/modules/content/header/cm_header_store_mode.php didn't work.https://mystore.com/my-admin/modules_content.php?action=configure&module=cm_header_store_mode#section_header I do not understand, this is the link to configure the header module, not the link to install the header tag module:https://mystore.com/my-admin/modules_content.php?action=configure&module=cm_header_store_mode#section_header"action=configure&module=cm_header_store_mode#section_header"must be:"set=header_tags&module=ht_store_mode&action=install" The includes/modules/header_tags/ht_store_mode.php wouldn't install. Kept giving me a 500 Internal ErrorThe ht_store_mode.php from your first version installed just fine.https://mystore.com/my-admin/modules.php?set=header_tags&module=ht_store_mode Maybe you didn't uninstall the first version before replacing. Try to uninstall the ht module, check in your databas table configuration that no entry beginning with "MODULE_HEADER_TAGS_STORE_MODE(%wildcard)" is left and remove if you find any.Then install again the ht module. I forgot to mention the beta2 stops Twitter Typeahead Autocomplete Search from working. Works for me in my live store where I'm using it. It sounds me pretty much to same problem you reported for the shop by price and manufacturer box. So it's a problem with your store installation, not with the store mode module.Please post the exact version you are using, there are several. Anyway checking your report I found another serious bug for stores using SEO URLs or other rewrite rules in their .htaccess file.Here the fix, the store mode rewrite rules are now wrapped inside "#Store Mode Begin" and "#Store Mode End" comments to be unique. Please use this version for testing:Store Mode Closed Maintenance BS 1.0 beta3.zipThanks and kind regardsRainer Edited December 5, 2016 by raiwa Quote About Me: http://www.oscommerce.com/forums/user/249059-raiwa/ Need help? How To Get The Help You Need Is your version of osC up to date? You'll find the latest osC community version CE Phoenix here. Public Phoenix Change Log Cheat Set on Google Sheets Link to comment Share on other sites More sharing options...
ecommunlimited Posted December 5, 2016 Share Posted December 5, 2016 @@raiwa The "Install Now" was the link I was talking about that would not install in beta 2. I had to use the Install button to the right. Store Mode " Header Tag module is not installed or not enabled.It is required, please install and enable. Install Now----------------------------------------------------------------------------------------------------------------There is NOT a 500 Internal Error with beta 3 but there was with beta 2 at: includes/modules/header_tags/ht_store_mode.php I may not have uninstalled the beta 1 and that could have been some of the problem. ----------------------------------------------------------------------------------------------------------------The problem with Twitter Typeahead Autocomplete Search is on my and and NOT with your mod. I still had a problem after uninstalling your mod. Desktop works but mobile is giving me this error. It never use to.1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'or hts.keyword like '%cd%'(pd.products_name like '%cd%' or p.products_model like' at line 1select count(distinct p.products_id) as total from products p left join products_to_products_extra_fields p2pef on p.products_id=p2pef.products_id left join manufacturers m on p.manufacturers_id=m.manufacturers_id left join specials s on p.products_id = s.products_id, products_description pd, categories c, products_to_categories p2c where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and ( or hts.keyword like '%cd%'(pd.products_name like '%cd%' or p.products_model like '%cd%' or m.manufacturers_name like '%cd%' or p2pef.products_extra_fields_value like '%cd%') )[TEP STOP] ---------------------------------------------------------------------------------------------------------------- Even when I remove my IP address I can't see the Store Closed info. Is there something I'm missing? I even cleared the cache. Take care Bill Quote Link to comment Share on other sites More sharing options...
♥raiwa Posted December 5, 2016 Author Share Posted December 5, 2016 Hello Bill @@ecommunlimited, The "Install Now" was the link I was talking about that would not install in beta 2. I had to use the Install button to the right.Store Mode " Header Tag module is not installed or not enabled.It is required, please install and enable. Install Now Sorry, I do not understand the problem. Even when I remove my IP address I can't see the Store Closed info. Is there something I'm missing? I even cleared the cache. You can't remove your IP in the module, it is checked and auto added each time when you open or save the module settings.You could only do it directly in the database or editing the .htaccess filePlease use "test " modes to check if redirects and messages work. 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'or hts.keyword like '%cd%'(pd.products_name like '%cd%' or p.products_model like' at line 1select count(distinct p.products_id) as total from products p left join products_to_products_extra_fields p2pef on p.products_id=p2pef.products_id left join manufacturers m on p.manufacturers_id=m.manufacturers_id left join specials s on p.products_id = s.products_id, products_description pd, categories c, products_to_categories p2c where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and ( or hts.keyword like '%cd%'(pd.products_name like '%cd%' or p.products_model like '%cd%' or m.manufacturers_name like '%cd%' or p2pef.products_extra_fields_value like '%cd%') ) This has nothing to do with store mode. Thank You Rainer Quote About Me: http://www.oscommerce.com/forums/user/249059-raiwa/ Need help? How To Get The Help You Need Is your version of osC up to date? You'll find the latest osC community version CE Phoenix here. Public Phoenix Change Log Cheat Set on Google Sheets Link to comment Share on other sites More sharing options...
Fiber Posted December 5, 2016 Share Posted December 5, 2016 Testing with Store Mode Closed Maintenance BS 1.0 beta3.zip have already installed you're first version, did not have the time to comment and before installing beta3 removed the module's en installed beta3, after testing and add in maintance de language dutch all was good en working. Now after clicking on a product I'am getting this error Not Found The requested URL /xxx/xxx.html was not found on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. Checking .htaccess and is empty, putting back the master htaccess made previously from version 1, and links are working but the module is not working any more. Quote Link to comment Share on other sites More sharing options...
Fiber Posted December 5, 2016 Share Posted December 5, 2016 Correction of the above After making modules inactive and remove in admin and reinstall again all was well, but a question. in modules/content see the screenshot, the module is installed and active Great addon thnx raiwa 1 Quote Link to comment Share on other sites More sharing options...
♥raiwa Posted December 5, 2016 Author Share Posted December 5, 2016 @@Fiber, @@ecommunlimited, and other testers Yes, there is a typo in the content header module. In: includes/modules/content/header/cm_header_store_mode.php line 34 should be: if (!defined('MODULE_HEADER_TAGS_STORE_MODE_STATUS') || defined('MODULE_HEADER_TAGS_STORE_MODE_STATUS') && MODULE_HEADER_TAGS_STORE_MODE_STATUS != 'true' ) { It said "True" at the end of this line, must be "true", small letter instead of big letter. The .htaccess problem should be fixed with the changes in beta3. Of course, best is to uninstall and remove all before trying a new beta, the modules do not take in consideration and check configuration entries of previous beta versions when installing. Thank You Bert :thumbsup: rgds Rainer Quote About Me: http://www.oscommerce.com/forums/user/249059-raiwa/ Need help? How To Get The Help You Need Is your version of osC up to date? You'll find the latest osC community version CE Phoenix here. Public Phoenix Change Log Cheat Set on Google Sheets Link to comment Share on other sites More sharing options...
Fiber Posted December 5, 2016 Share Posted December 5, 2016 thnx solved now :) Another question see screen should not be there the configuration of the module? example, he is now online so that the txt shoud say online? Quote Link to comment Share on other sites More sharing options...
♥raiwa Posted December 5, 2016 Author Share Posted December 5, 2016 thnx solved now :) Another question see screen should not be there the configuration of the module? example, he is now online so that the txt shoud say online? It seems this doesn't work with radio buttons. I'll have a look if I can find a solution. Quote About Me: http://www.oscommerce.com/forums/user/249059-raiwa/ Need help? How To Get The Help You Need Is your version of osC up to date? You'll find the latest osC community version CE Phoenix here. Public Phoenix Change Log Cheat Set on Google Sheets Link to comment Share on other sites More sharing options...
Fiber Posted December 5, 2016 Share Posted December 5, 2016 Quote Link to comment Share on other sites More sharing options...
ecommunlimited Posted December 5, 2016 Share Posted December 5, 2016 @@raiwa All errors I mentioned earlier were on my end and NOT within you mod. Once I corrected the issues your beta 3 mod works great for what I tested. I apologize for the confusion. Take care Bill Quote Link to comment Share on other sites More sharing options...
frankl Posted December 5, 2016 Share Posted December 5, 2016 @@raiwa Works fine in all test modes for me, apart from the problem that Fiber posted above. Quote osCommerce user since 2003! Link to comment Share on other sites More sharing options...
♥raiwa Posted December 6, 2016 Author Share Posted December 6, 2016 @@ecommunlimited, @@Fiber, @@frankl, thank you for testing and reports :thumbsup: :thumbsup: :thumbsup:Found the fix to show the selected mode in ht_store_mode.php.The text needed to be passed through the ht_store_mode_add_to_htaccess function.Changes in ht_store_mode.phpLine 381: function ht_store_mode_add_to_htaccess($mode_text) { and line 434 added: $file = preg_replace('@#Store Mode Begin((?:.|[\r\n])+?)#Store Mode End\n\n@', '', $file); file_put_contents(DIR_FS_CATALOG . '.htaccess', $file); } } return nl2br(implode("\n", explode(';', $mode_text))); } There was also a bug in the same function: $file = preg_replace('@#Store Mode Begin((?:.|[\r\n])+?)</IfModule>\n\n@', '', $file); must be: $file = preg_replace('@#Store Mode Begin((?:.|[\r\n])+?)#Store Mode End\n\n@', '', $file); This prevented the correct change of the rewrite rules if store mode was changed from offline_test to offline or viceversa. Uploaded to add-ons: Store Mode BSTo update from beta3 just replace the ht module, no uninstall needed. Thanks again and best regards Rainer Quote About Me: http://www.oscommerce.com/forums/user/249059-raiwa/ Need help? How To Get The Help You Need Is your version of osC up to date? You'll find the latest osC community version CE Phoenix here. Public Phoenix Change Log Cheat Set on Google Sheets Link to comment Share on other sites More sharing options...
ecommunlimited Posted December 6, 2016 Share Posted December 6, 2016 (edited) @@raiwa The text-left does not align to the left. All stayed in the center. Content Align:How should the content be aligned?text-left text-center text-right -------------------------------------------------------------------------------- When I uninstalled this mod from the content header and header tags it was still set to offline-test. It did not remove the rewrite from the .htaccess. I had to manually do it. Store ModeTest Modes: Only allowed IPs will be redirected.offline-test Take care Bill Edited December 6, 2016 by ecommunlimited Quote Link to comment Share on other sites More sharing options...
♥raiwa Posted December 6, 2016 Author Share Posted December 6, 2016 Hello Bill, The text-left does not align to the left. All stayed in the center. Content Align:How should the content be aligned?text-left text-center text-right Just checked and it works for me, the text of the messages aligns right - left - center depending on the setting. Whole message modules doesn't change because it occupies whole available width. When I uninstalled this mod from the content header and header tags it was still set to offline-test.It did not remove the rewrite from the .htaccess. I had to manually do it. Store ModeTest Modes: Only allowed IPs will be redirected.offline-test Yes, good point, the .htaccess file should be restored on uninstall. However for now just switch back to online before uninstall. Anyway I planned to update adding at the very top of all pages permanent store mode messages (online if not online of course) in admin and in the public store for administrator IPs. This would serve as a reminder to administrators that the store is not in online mode, so they won't forget to switch it back. Another idea was to auto add the store name to the maintenance file on installation and maybe optional add the store mail or contact form. Your thoughts? I'll await a week or so to see if there appear more bugs/suggestions. Thank You and kind regards Rainer Quote About Me: http://www.oscommerce.com/forums/user/249059-raiwa/ Need help? How To Get The Help You Need Is your version of osC up to date? You'll find the latest osC community version CE Phoenix here. Public Phoenix Change Log Cheat Set on Google Sheets Link to comment Share on other sites More sharing options...
ecommunlimited Posted December 6, 2016 Share Posted December 6, 2016 @@raiwa I planned to update adding at the very top of all pages permanent store mode messages (online if not online of course) in admin and in the public store for administrator IPs. This would serve as a reminder to administrators that the store is not in online mode, so they won't forget to switch it back.Another idea was to auto add the store name to the maintenance file on installation and maybe optional add the store mail or contact form. I believe this would be great! Take care Bill Quote Link to comment Share on other sites More sharing options...
♥raiwa Posted December 6, 2016 Author Share Posted December 6, 2016 The fix for to restore .htaccess when uninstall: function remove() { tep_db_query("delete from configuration where configuration_key in ('" . implode("', '", $this->keys()) . "')"); // remove rewrite rules $file = file_get_contents(DIR_FS_CATALOG . '.htaccess'); if ( strpos($file, 'RewriteRule .* maintenance.php? [R=302,L]') > 0 ) { $file = preg_replace('@#Store Mode Begin((?:.|[\r\n])+?)#Store Mode End\n\n@', '', $file); file_put_contents(DIR_FS_CATALOG . '.htaccess', $file); } } includes/modules/header_tags/ht_store_mode.php Quote About Me: http://www.oscommerce.com/forums/user/249059-raiwa/ Need help? How To Get The Help You Need Is your version of osC up to date? You'll find the latest osC community version CE Phoenix here. Public Phoenix Change Log Cheat Set on Google Sheets Link to comment Share on other sites More sharing options...
ecommunlimited Posted December 6, 2016 Share Posted December 6, 2016 @@raiwa Your restore .htaccess fix works perfect even when set to offline_test! Take care Bill Quote Link to comment Share on other sites More sharing options...
ecommunlimited Posted December 6, 2016 Share Posted December 6, 2016 @@raiwa I fully tested all available options and everything seemed to work for me. osC: V2.3.4 BSrApachePHP Version: 7.0.12Database: MySQL 5.6.33 Take care Bill raiwa 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.