BrockleyJohn Posted March 13, 2017 Share Posted March 13, 2017 A rewrite of the Store Open/Closed addon. The closing of pages is an option so it could be used in a store that's open all the time , e.g. to display whether the customer service phone line is operating. Written for osc 2.3.4 BS Gold and upwards. Set store opening times and open and close checkout:- Set opening & closing time for each weekday – or set the day to closed- Define dates and ranges for holidays in the current year; choose to use European or US date format in admin settings- Set time zone of store to allow for server and store in different zones- Format for date displays in catalogue and admin are taken from language files to support multi-language/international stores- Option to close store checkout (or any other pages) by diverting to the Store Times page during closed hours- Store Times page displays shop hours and holidays- Header message displays store status- Dashboard module shows current status and allows admin to override it- On installation, picks up opening times and holidays from addon 8044 Store Open/Closed if available Download and github links to follow shortly. Quote Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released. Looking for a payment or shipping module? Maybe I've already done it. Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x Link to comment Share on other sites More sharing options...
BrockleyJohn Posted March 13, 2017 Author Share Posted March 13, 2017 Download from addons: http://addons.oscommerce.com/info/9556 Pull from github: https://github.com/BrockleyJohn/Responsive-osCommerce/tree/addon_store_times_bs altoid 1 Quote Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released. Looking for a payment or shipping module? Maybe I've already done it. Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x Link to comment Share on other sites More sharing options...
sunshynecraftsbeads Posted April 5, 2017 Share Posted April 5, 2017 Hi John, Thank you very much for this rewrite. I look forward to adding it to my store. I have come across a few error messages in my admin and I was wondering if you could help me correct the errors. I have using the 2.3.4 BS version. When I try to install the header tags I am unable to install it and the following warning messages is on the header tag page of my admin area. Warning: includes/languages/english/modules/header_tags/store_times.php): failed to open stream: No such file or directory in public_html/admin/modules.php on line 141Warning: include(): Failed opening 'public_html/includes/languages/english/modules/header_tags/store_times.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in public_html/admin/modules.php on line 141Fatal error: require(): Cannot redeclare class logger in public_html/admin/includes/application_top.php on line 78 Any help or input would be greatly appreciated. Thank you in advance. Cheers. Quote Link to comment Share on other sites More sharing options...
frankl Posted April 6, 2017 Share Posted April 6, 2017 @@sunshynecraftsbeads You haven't uploaded all the files correctly. Do so and your errors will disappear. Quote osCommerce user since 2003! Link to comment Share on other sites More sharing options...
sunshynecraftsbeads Posted April 6, 2017 Share Posted April 6, 2017 (edited) Thanks @@frankl for the feedback. New day. New Beginnings. And Fresh Eyes Re Installed and works perfectly. :thumbsup: My next task, changing the box color from orange to match my site. I'll figure it out soon enough. :D Again thank you Frank for taking the time to help me. Have a great day ! Edited April 6, 2017 by sunshynecraftsbeads Quote Link to comment Share on other sites More sharing options...
BrockleyJohn Posted April 6, 2017 Author Share Posted April 6, 2017 My next task, changing the box color from orange to match my site. I'll figure it out soon enough. :D The colour of the box is the same as other alert messages on your site. When the store is open, you get the success colour; when closed, warning colour. You can change these with rules in user css that acts on classes .alert-success and .alert-warning respectively. If you want to change the store open/closed box colour without changing the message colours, you'd need to edit the first line of the template in catalog\includes\modules\content\header\templates\store_times.php to something like <div class="col-sm-12"><div class="text-center alert storebox-<?php echo $type; ?>"> then your css rules would need to address classes .storebox-success and .storebox-warning Quote Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released. Looking for a payment or shipping module? Maybe I've already done it. Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x Link to comment Share on other sites More sharing options...
BrockleyJohn Posted May 30, 2017 Author Share Posted May 30, 2017 Bugfix release v1.2: I spotted that the feature that diverts pages when the store is closed was ignoring the admin override (to open early or stay open later). When I get access to the addons area again I will upload a new release. In the meantime, I attach a fixed version of includes/modules/header_tags/ht_store_times.php ht_store_times.php Quote Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released. Looking for a payment or shipping module? Maybe I've already done it. Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x Link to comment Share on other sites More sharing options...
BrockleyJohn Posted June 12, 2017 Author Share Posted June 12, 2017 v1.2 now available in the new look addons/apps area: https://apps.oscommerce.com/Apps&8iAPs&store-times-bs Quote Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released. Looking for a payment or shipping module? Maybe I've already done it. Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x Link to comment Share on other sites More sharing options...
greasemonkey Posted November 15, 2017 Share Posted November 15, 2017 @BrockleyJohn just looking at this addon out to fix my server time issue (I'm in America/Toronto however my server is in America/Chicago) However, I don't require the opening a closing configs. Is there a simple config to have the store open 24/7? Quote Link to comment Share on other sites More sharing options...
BrockleyJohn Posted November 15, 2017 Author Share Posted November 15, 2017 @greasemonkey Scott, what server time issue do you want to fix? I gather there's a time difference between your server and your store but this addon isn't going to change the time on your orders etc. I think you should be able to sort that out by setting the correct time zone - the 'proper' way is in your php.ini Even if you are on shared hosting you can usually have your own version of php.ini somehow but in this case you'd probably need to get support to help you set it up - and if you want to change php version you'd need to redo it. That's the only option I can think of if you want to avoid changing any core code but if you're not being anal about that an easier option is to set it in the code - probably in your two application_top files. Your statement should be: date_default_timezone_set('America/Toronto'); preferably before anything much else happens. Quote Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released. Looking for a payment or shipping module? Maybe I've already done it. Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x Link to comment Share on other sites More sharing options...
greasemonkey Posted November 15, 2017 Share Posted November 15, 2017 @BrockleyJohn thanks so much for your quick answer.... I'll try not to get your support thread too off topic then. Yes, I have my php.ini file set to date.timezone = "America/Toronto" And when I navigate to admin/server_info it does show correctly... including on admin/whos_online.... However the date for orders in the DB is 1 hour ahead. Example an order placed at EST 15:21:30 (my time.... as stamped by the CC processing API) landed in the orders table as 2017-11-15 16:21:30? Thinking about this.... that wouldn't be the server time (the server is on CST which would be 14:21:30)????? Quote Link to comment Share on other sites More sharing options...
BrockleyJohn Posted November 15, 2017 Author Share Posted November 15, 2017 (edited) Hmm, maybe your mysql time zone is out of step. If I remember correctly mysql stores everything as UTC and converts it on the way in and out. It also has two time zones, a global one and one for each session. SELECT @@global.time_zone, @@session.time_zone; will find out what they are set to (if it's SYSTEM, it's the system timezone) SET time_zone = timezone; will set it but in my (admittedly limited) experience the timezone table isn't often set up, so you probably can't use 'America/Toronto' and will have instead to express it as '-5:00' (your time relative to me as I live 5 miles due south of the Greenwich observatory!) If you go down this route it'll need a bit of research into daylight saving, I don't know if mysql adjusts for it or not if you do this - your setting code might need to. Edited November 15, 2017 by BrockleyJohn Quote Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released. Looking for a payment or shipping module? Maybe I've already done it. Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x Link to comment Share on other sites More sharing options...
greasemonkey Posted November 16, 2017 Share Posted November 16, 2017 @BrockleyJohn yes it would seem to be an issue with MySQL. It is currently set at -4 GMT and America/Toronto is currently -5 GMT (we are -4 GMT in daylight savings time.... which ended 11/5). Researching quickly it seem like a timezone table could/should be set up... Quote Link to comment Share on other sites More sharing options...
BrockleyJohn Posted November 16, 2017 Author Share Posted November 16, 2017 (edited) @greasemonkey look what I found: A neat way to change PHP / MySQL timezones at the script level In a nutshell, if php is using the right timezone and handling daylight savings, just use the format of php date that expresses the offset from UTC to set the MySQL timezone: "SET `time_zone` = '".date('P')."'" Since MySQL always stores datetimes in UTC, your existing data will be magically corrected. So there are two statements for a complete solution date_default_timezone_set('America/Toronto'); tep_db_query("SET `time_zone` = '".date('P')."'"); Edited November 16, 2017 by BrockleyJohn Quote Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released. Looking for a payment or shipping module? Maybe I've already done it. Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x Link to comment Share on other sites More sharing options...
greasemonkey Posted November 16, 2017 Share Posted November 16, 2017 @BrockleyJohn thanks again for your help. I spoke to my host about it last night and it turned out to be a simple fix - just a restart of mysqld....I presume it glitched out with the time change last week. Here was their reply for those interested: Quote MySQL will by default simply inherit current time zone from the server, and that's what set on your server currently:mysql> show global variables like 'time%'; +---------------+----------+ | Variable_name | Value | +---------------+----------+ | time_format | %H:%i:%s | | time_zone | SYSTEM | | timed_mutexes | OFF | +---------------+----------+ 3 rows in set (0.00 sec)Current time and timezone on your server is correct for EST:root@host [1678 19:19:15 ~]# date Wed Nov 15 19:19:16 EST 2017But I do see what you describe specific to MySQL:mysql> SELECT NOW(); +---------------------+ | NOW() | +---------------------+ | 2017-11-15 20:19:13 | +---------------------+ 1 row in set (0.00 sec)Time according to MySQL is 1 hour ahead of actual, which would be consistent with GMT -0400. It may be that mysqld itself simply needs to be restarted to reflect the proper time, its current uptime is 50 days+, which would encompass the point in time DST changed to EST. I can go ahead and try to restart MySQL to see if that produces consistent time within MySQL reflective of system / actual time. Quote Link to comment Share on other sites More sharing options...
YePix Posted May 8, 2018 Share Posted May 8, 2018 (edited) Hello everyone is there a possibility to enter the opening times in two stages? Monday 12:00 - 14:00 / 17:00 - 23:00 Edited May 8, 2018 by Yepi Quote Link to comment Share on other sites More sharing options...
BrockleyJohn Posted May 9, 2018 Author Share Posted May 9, 2018 @Yepi hi Peter, this version does not support siesta or closing time after midnight. Quote Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released. Looking for a payment or shipping module? Maybe I've already done it. Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x Link to comment Share on other sites More sharing options...
YePix Posted May 9, 2018 Share Posted May 9, 2018 Too bad but thanks anyway is a great contrib Quote Link to comment Share on other sites More sharing options...
burt Posted May 9, 2018 Share Posted May 9, 2018 2 hours ago, Yepi said: Too bad but thanks anyway is a great contrib There is one and only one that supports multiple open/close per day. It is a commercial module, made by me, for the Community Bootstrap Version. If of interest, PM me. Quote Link to comment Share on other sites More sharing options...
YePix Posted May 11, 2018 Share Posted May 11, 2018 Hi @burt, give me more information about the module. I already have interest. Quote Link to comment Share on other sites More sharing options...
YePix Posted September 10, 2019 Share Posted September 10, 2019 (edited) small bugfix for "stort times" replace the following code in header tags to disable forwarding when the module is deactivated catalog/includes/modules/header_tags/ht_store_times.php osCommerce 2.3.4-1 EDGE find: if (defined('MOD_CON_HDR_STORE_TIMES_DIVERT_PAGES') && MOD_CON_HDR_STORE_TIMES_DIVERT_PAGES == 'True') { if (tep_not_null(MOD_CON_HDR_STORE_TIMES_CLOSE_PAGES)) { $pages_array = array(); foreach (explode(';', MOD_CON_HDR_STORE_TIMES_CLOSE_PAGES) as $page) { $page = trim($page); if (!empty($page)) { $pages_array[] = $page; } } if (in_array(basename($PHP_SELF), $pages_array)) { $store_status = sew_is_store_open(); if ($store_status <> 'open' && $store_status <> 'open-override') tep_redirect('store_times.php'); } } } } replace with: if (MODULE_CONTENT_HEADER_STORE_TIMES_STATUS == 'True') { if (defined('MOD_CON_HDR_STORE_TIMES_DIVERT_PAGES') && MOD_CON_HDR_STORE_TIMES_DIVERT_PAGES == 'True') { if (tep_not_null(MOD_CON_HDR_STORE_TIMES_CLOSE_PAGES)) { $pages_array = array(); foreach (explode(';', MOD_CON_HDR_STORE_TIMES_CLOSE_PAGES) as $page) { $page = trim($page); if (!empty($page)) { $pages_array[] = $page; } } if (in_array(basename($PHP_SELF), $pages_array)) { $store_status = sew_is_store_open(); if ($store_status <> 'open' && $store_status <> 'open-override') tep_redirect('store_times.php'); } } } } } Thus, the header_tag module does not need to be turned off Edited September 10, 2019 by YePix Quote Link to comment Share on other sites More sharing options...
fridgebox Posted September 10, 2019 Share Posted September 10, 2019 Nothing better on the net:https://freek.dev/595-managing-opening-hours-with-php Requires composer: https://github.com/spatie/opening-hours ( based on above link) Quote Link to comment Share on other sites More sharing options...
fridgebox Posted September 10, 2019 Share Posted September 10, 2019 1 hour ago, YePix said: small bugfix for "stort times" replace the following code in header tags to disable forwarding when the module is deactivated catalog/includes/modules/header_tags/ht_store_times.php osCommerce 2.3.4-1 EDGE find: if (defined('MOD_CON_HDR_STORE_TIMES_DIVERT_PAGES') && MOD_CON_HDR_STORE_TIMES_DIVERT_PAGES == 'True') { if (tep_not_null(MOD_CON_HDR_STORE_TIMES_CLOSE_PAGES)) { $pages_array = array(); foreach (explode(';', MOD_CON_HDR_STORE_TIMES_CLOSE_PAGES) as $page) { $page = trim($page); if (!empty($page)) { $pages_array[] = $page; } } if (in_array(basename($PHP_SELF), $pages_array)) { $store_status = sew_is_store_open(); if ($store_status <> 'open' && $store_status <> 'open-override') tep_redirect('store_times.php'); } } } } replace with: if (MODULE_CONTENT_HEADER_STORE_TIMES_STATUS == 'True') { if (defined('MOD_CON_HDR_STORE_TIMES_DIVERT_PAGES') && MOD_CON_HDR_STORE_TIMES_DIVERT_PAGES == 'True') { if (tep_not_null(MOD_CON_HDR_STORE_TIMES_CLOSE_PAGES)) { $pages_array = array(); foreach (explode(';', MOD_CON_HDR_STORE_TIMES_CLOSE_PAGES) as $page) { $page = trim($page); if (!empty($page)) { $pages_array[] = $page; } } if (in_array(basename($PHP_SELF), $pages_array)) { $store_status = sew_is_store_open(); if ($store_status <> 'open' && $store_status <> 'open-override') tep_redirect('store_times.php'); } } } } } Thus, the header_tag module does not need to be turned off you could have just say what is wrong. I cannot see with a "look for" and "replace" with........... what is the actual bug? I prefer to see compare A with B and highlight the difference. I not learn anything from "replace with" Quote Link to comment Share on other sites More sharing options...
fridgebox Posted September 10, 2019 Share Posted September 10, 2019 (edited) Found it: if (MODULE_CONTENT_HEADER_STORE_TIMES_STATUS == 'True') { #put what i told to look for in here } Now we know what you did, and can be traced in some way. Edited September 10, 2019 by fridgebox Quote Link to comment Share on other sites More sharing options...
YePix Posted September 10, 2019 Share Posted September 10, 2019 that's how you do it 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.