Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WC Marketplace › Show store hour in [wcfm_stores] it's possible?
- This topic has 10 replies, 4 voices, and was last updated 4 years, 3 months ago by gilcrodua.
- AuthorPosts
- April 16, 2020 at 4:49 am #119573HERMES ALVES SOUZAParticipant
Hello,
Is it possible to show the opening hours of the stores in the list? Using or shortcode I need to display whether the stores are currently open or closed.
https://docs.wclovers.com/store-list/
https://wclovers.com/knowledgebase/wcfm-marketplace-store-hours/ - April 16, 2020 at 11:52 am #119646Sarmistha ChakrabortyMember
Hello,
To show store hours in the store list page,
Add this code to your child theme’s functions.php
In case you do not have child theme then add code using this plugin – https://wordpress.org/plugins/code-snippets/add_action('wcfmmp_store_list_after_store_info','fn_wcfmmp_store_list_after_store_info',11,2); function fn_wcfmmp_store_list_after_store_info($store_id, $store_info) { global $WCFM, $WCFMmp, $wp, $WCFM_Query; $store_user = wcfmmp_get_store( $store_id ); $wcfm_vendor_store_hours = get_user_meta( $store_id, 'wcfm_vendor_store_hours', true ); if( !$wcfm_vendor_store_hours ) { return; } $wcfm_store_hours_enable = isset( $wcfm_vendor_store_hours['enable'] ) ? 'yes' : 'no'; if( $wcfm_store_hours_enable != 'yes' ) return; $wcfm_store_hours_off_days = isset( $wcfm_vendor_store_hours['off_days'] ) ? $wcfm_vendor_store_hours['off_days'] : array(); $wcfm_store_hours_day_times = isset( $wcfm_vendor_store_hours['day_times'] ) ? $wcfm_vendor_store_hours['day_times'] : array(); if( empty( $wcfm_store_hours_day_times ) ) return; $weekdays = array( 0 => __( 'Monday', 'wc-multivendor-marketplace' ), 1 => __( 'Tuesday', 'wc-multivendor-marketplace' ), 2 => __( 'Wednesday', 'wc-multivendor-marketplace' ), 3 => __( 'Thursday', 'wc-multivendor-marketplace' ), 4 => __( 'Friday', 'wc-multivendor-marketplace' ), 5 => __( 'Saturday', 'wc-multivendor-marketplace' ), 6 => __( 'Sunday', 'wc-multivendor-marketplace') ); ?> <div class="wcfmmp_store_hours"> <span class="wcfmmp-store-hours widget-title"><span class="wcfmfa fa-clock"></span>Store Hours</span><div class="wcfm_clearfix"></div> <?php foreach( $wcfm_store_hours_day_times as $wcfm_store_hours_day => $wcfm_store_hours_day_time_slots ) { if( in_array( $wcfm_store_hours_day, $wcfm_store_hours_off_days ) ) continue; if( !isset( $wcfm_store_hours_day_time_slots[0] ) || !isset( $wcfm_store_hours_day_time_slots[0]['start'] ) ) return; if( empty( $wcfm_store_hours_day_time_slots[0]['start'] ) || empty( $wcfm_store_hours_day_time_slots[0]['end'] ) ) continue; echo '<span class="wcfmmp-store-hours-day">' . $weekdays[$wcfm_store_hours_day] . ':</span>'; foreach( $wcfm_store_hours_day_time_slots as $slot => $wcfm_store_hours_day_time_slot ) { echo "<br />" . date_i18n( wc_time_format(), strtotime( $wcfm_store_hours_day_time_slot['start'] ) ) . " - " . date_i18n( wc_time_format(), strtotime( $wcfm_store_hours_day_time_slot['end'] ) ); } echo '<br /><br />'; } ?> </div> <?php }
Thanks.
- April 16, 2020 at 11:23 pm #119862HERMES ALVES SOUZAParticipant
Works fine! Thanks again.
Deus abençoe vocês.
- April 20, 2020 at 8:43 pm #121055Sarmistha ChakrabortyMember
You are always welcome 🙂
Let me know if there’s anything else we can help you with.
Can we ask for a favor? Would you mind taking a few minutes to review our plugin at https://wordpress.org/support/plugin/wc-multivendor-marketplace/reviews/ and let others know about your 5 Star experience with WCFM Marketplace. Also, follow us on Twitter https://twitter.com/wcfmmp for more exciting news, important updates, and irresistible offers. - June 15, 2020 at 11:32 pm #141502zsoldosbotondangolParticipant
Hi
I would be grateful for some help with this one as well
So my problem is that this code displays opening hours for every day and it looks like this for me
Could you please help me with displaying just today’s opening hours without this bugging? For instance, if it’s Friday I only want to see Friday opening hours
Many thanks in advanceAttachments:
You must be logged in to view attached files.- June 17, 2020 at 10:00 pm #142039Sarmistha ChakrabortyMember
Hello,
For this, you need to override wcfmmp-view-store-hours.php in your theme folder
yourtheme/wcfm/store/widgets
from\wp-content\plugins\wc-multivendor-marketplace\views\store\widgets
and modify the code –global $WCFM, $WCFMmp; $day_number = date('w', time()); if($day_number == 0) { $day = 6; } else { $day = $day_number-1; } foreach( $wcfm_store_hours_day_times[$day] as $wcfm_store_hours_day => $wcfm_store_hours_day_time_slots ) { if( in_array( $wcfm_store_hours_day, $wcfm_store_hours_day_times[$day] ) ) continue; if( !isset( $wcfm_store_hours_day_time_slots['start'] ) ) return; if( empty( $wcfm_store_hours_day_time_slots['start'] ) || empty( $wcfm_store_hours_day_time_slots['end'] ) ) continue; echo '<span class="wcfmmp-store-hours-day">' . $weekdays[$day] . ':</span>'; echo "<br />" . date_i18n( wc_time_format(), strtotime( $wcfm_store_hours_day_time_slots['start'] ) ) . " - " . date_i18n( wc_time_format(), strtotime( $wcfm_store_hours_day_time_slots['end'] ) ); echo '<br /><br />'; }
Thanks.
- June 20, 2020 at 8:01 pm #142791zsoldosbotondangolParticipant
Hi,
thank you for the quick reply – this code, however, doesn’t do anything. I’m using OceanWP – I didn’t have a yourtheme/wcfm/store/widget folder, but I created it – copied the file there and pasted the code you wrote here. Can you please tell me in a bit more detail what should I do here? Because I’m sure I did it in the wrong way 😀
- June 20, 2020 at 8:09 pm #142792zsoldosbotondangolParticipant
Hi,
Sorry I might’ve wrote it wrong – so it does work on the simple product page/store page, but it doesn’t work for the cards (the store_list)
- June 20, 2020 at 8:10 pm #142793zsoldosbotondangolParticipant
Also the bug is still there, please check the picture below
Attachments:
You must be logged in to view attached files. - June 30, 2020 at 2:37 am #145100zsoldosbotondangolParticipant
Hello,
I know you must be very busy these days but I opened some threads regarding this topic on other support sites, could you please answer my questions? I would be really grateful for your help & if we need to pay for this please notify us about the price
Thank You
https://wordpress.org/support/topic/vendor-price-range/
https://wordpress.org/support/topic/store-hours-only-today/ - July 28, 2020 at 7:50 am #156790gilcroduaParticipant
Hi, also want to inquire about the same. is it possible for the store banner to show if the store is closed instead of accessing the store directly (same message that is showing in the store page when the store is closed?) (it will be nice if on the vendor list it shows the store status via the store banner- whether it’s open or closed)
- AuthorPosts
- You must be logged in to reply to this topic.