Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WC Vendors › URL adresse web site vendor
Tagged: URL vendor
- This topic has 22 replies, 2 voices, and was last updated 4 years, 8 months ago by
verrouillage.ma.
- AuthorPosts
- April 26, 2020 at 11:11 pm #123401
verrouillage.ma
ParticipantHello,
thank you for this application which I appreciate much,
I would like to provide for premium customers the URL address of their website, is this possibleThank you
- April 27, 2020 at 11:28 am #123556
Sushobhan
KeymasterHi,
Thanks for getting in touch with us!
Where you want to show this url, inside their store page? Can you provide me a snapshot annotating the position? If it’s only about showing an URL address for certain vendors then it can be easily achieved with some custom line of codes.
Looking forward to helping you. - April 28, 2020 at 10:14 pm #124377
verrouillage.ma
ParticipantHello
thank you for your reply.
as explained on the image I would like to add the website of the seller subscribed but not visible to other subscriber
Thank youAttachments:
You must be logged in to view attached files. - April 28, 2020 at 10:22 pm #124381
Sushobhan
KeymasterAre you telling me that only the vendor can see this information (url) in their own store page and no one else (other vendor or customers) can’t see it. Am I right?
- April 28, 2020 at 11:26 pm #124406
verrouillage.ma
Participantno what this means is this information will be visible on the seller’s page and products.
but I want to control this option for a different group, either display it or not - April 29, 2020 at 12:54 pm #124542
Sushobhan
KeymasterHello,
It can’t be done using a small snippet. It will require some customization. Are you using WCFM Groups plugin for grouping your vendors by capabilities?
Looking forward to helping you. - April 29, 2020 at 8:50 pm #124720
verrouillage.ma
Participantyes i use WCFM groups and staph
- April 30, 2020 at 8:57 pm #125125
Sushobhan
KeymasterHello,
Use the following code for this purpose-add_action( 'wcfm_capability_settings_fields_settings_inside', function($fields) { global $wp, $wcfmgs_capability_manager_options; if ( is_wcfm_page() && ! empty( $wp->query_vars['groups-manage'] ) ) { $external_url = ( isset( $wcfmgs_capability_manager_options['external_url'] ) ) ? $wcfmgs_capability_manager_options['external_url'] : 'no'; $fields['external_url'] = array( 'label' => 'Website', 'name' => "wcfmgs_capability_manager_options[external_url]", 'type' => 'checkboxoffon', 'class' => 'wcfm-checkbox wcfm_ele', 'value' => 'yes', 'label_class' => 'wcfm_title checkbox_title', 'dfvalue' => $external_url, ); } return $fields; } ); add_filter( 'wcfm_marketplace_settings_fields_general', function($field, $user_id) { if ( can_vendor_show_url( $user_id ) && isset( $field['store_slug'] ) ) { $website_url = wcfm_get_user_meta( $user_id, '_wcfm_vendor_website_url' ); $field['website_url'] = array( 'label' => __( 'Website' ), 'type' => 'text', 'class' => 'wcfm-text wcfm_ele', 'label_class' => 'wcfm_title wcfm_ele', 'value' => $website_url ); } return $field; }, 10, 2 ); add_action( 'wcfm_vendor_settings_update', function( $vendor_id, $wcfm_settings_form ) { global $WCFM, $WCFMmp; if ( isset( $wcfm_settings_form['website_url'] ) ) { $website_url = $wcfm_settings_form['website_url']; wcfm_update_user_meta( $vendor_id, '_wcfm_vendor_website_url', $website_url ); } }, 500, 2 ); add_action( 'wcfmmp_store_after_email', function($vendor_id) { if ( can_vendor_show_url( $vendor_id ) ) { $website_url = wcfm_get_user_meta( $vendor_id, '_wcfm_vendor_website_url' ); ?> <div class="store_info_parallal wcfmmp_store_header_website" style="margin-right: 10px;"> <i class="wcfmfa fa-globe" aria-hidden="true"></i> <span> <a href="<?php echo $website_url; ?>"><?php echo $website_url; ?></a> </span> </div> <?php } } ); function can_vendor_show_url( $vendor_id ) { if ( ! (wcfm_is_vendor( $vendor_id )) ) return false; $wcfm_vendor_groups = array_filter( (array) get_user_meta( $vendor_id, '_wcfm_vendor_group', true ) ); if ( ! $wcfm_vendor_groups ) return false; $vendor_capability_options = (array) apply_filters( 'wcfmgs_user_capability', get_option( 'wcfm_capability_options' ), $vendor_id ); $external_url = isset( $vendor_capability_options['external_url'] ) ? $vendor_capability_options['external_url'] : 'no'; return $external_url === 'no'; }
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/
Let me know how this goes.
Thanks! - May 3, 2020 at 11:35 pm #126228
verrouillage.ma
ParticipantThank you very much for your response
result- on the administration we have the activation of the site
on the seller’s page there is the site icon but the site is not displayed
Thank you for the work you do - May 4, 2020 at 11:18 am #126335
Sushobhan
KeymasterHello,
Sorry about that, forgot to check for the empty url (not yet set by the vendor) case. Please replace your previous snippet with this new one –add_action( 'wcfm_capability_settings_fields_settings_inside', function($fields) { global $wp, $wcfmgs_capability_manager_options; if ( is_wcfm_page() && ! empty( $wp->query_vars['groups-manage'] ) ) { $external_url = ( isset( $wcfmgs_capability_manager_options['external_url'] ) ) ? $wcfmgs_capability_manager_options['external_url'] : 'no'; $fields['external_url'] = array( 'label' => 'Website', 'name' => "wcfmgs_capability_manager_options[external_url]", 'type' => 'checkboxoffon', 'class' => 'wcfm-checkbox wcfm_ele', 'value' => 'yes', 'label_class' => 'wcfm_title checkbox_title', 'dfvalue' => $external_url, ); } return $fields; } ); add_filter( 'wcfm_marketplace_settings_fields_general', function($field, $user_id) { if ( can_vendor_show_url( $user_id ) && isset( $field['store_slug'] ) ) { $website_url = wcfm_get_user_meta( $user_id, '_wcfm_vendor_website_url' ); $field['website_url'] = array( 'label' => __( 'Website' ), 'type' => 'text', 'class' => 'wcfm-text wcfm_ele', 'label_class' => 'wcfm_title wcfm_ele', 'value' => esc_url( $website_url ) ); } return $field; }, 10, 2 ); add_action( 'wcfm_vendor_settings_update', function( $vendor_id, $wcfm_settings_form ) { global $WCFM, $WCFMmp; if ( isset( $wcfm_settings_form['website_url'] ) ) { $website_url = esc_url_raw( $wcfm_settings_form['website_url'] ); wcfm_update_user_meta( $vendor_id, '_wcfm_vendor_website_url', $website_url ); } }, 500, 2 ); add_action( 'wcfmmp_store_after_email', function($vendor_id) { if ( can_vendor_show_url( $vendor_id ) ) { $website_url = esc_url( wcfm_get_user_meta( $vendor_id, '_wcfm_vendor_website_url' ) ); if ( $website_url ) { ?> <div class="store_info_parallal wcfmmp_store_header_website" style="margin-right: 10px;"> <i class="wcfmfa fa-globe" aria-hidden="true"></i> <span> <a href="<?php echo $website_url; ?>" target="_blank" rel="noopener noreferrer"><?php echo $website_url; ?></a> </span> </div> <?php } } } ); function can_vendor_show_url( $vendor_id ) { if ( ! (wcfm_is_vendor( $vendor_id )) ) return false; $wcfm_vendor_groups = array_filter( (array) get_user_meta( $vendor_id, '_wcfm_vendor_group', true ) ); if ( ! $wcfm_vendor_groups ) return false; $vendor_capability_options = (array) apply_filters( 'wcfmgs_user_capability', get_option( 'wcfm_capability_options' ), $vendor_id ); $external_url = isset( $vendor_capability_options['external_url'] ) ? $vendor_capability_options['external_url'] : 'no'; return $external_url === 'no'; }
Also last time I forgot to explain the behavior of this code, so here it is-
-This code will add a new capability ‘Website’ under each group, see pic- https://imgur.com/dmXiGXQ
-Then all the vendors of that group will get a new field under their settings page like this- https://imgur.com/v1oD1Ri
-Now, when a vendor set this field with a valid URL, then this information will be visible on their store page like this – https://imgur.com/gNp8cpVThank You!
- May 5, 2020 at 6:20 am #126770
verrouillage.ma
Participantgood morning dear friend
as you said everything is ok
but when we add the website address the store does not save the address - May 5, 2020 at 10:02 am #126814
Sushobhan
KeymasterHi,
Are you giving a valid url? We are using esc_url_raw function to sanitize user input, so if it’s not a valid url it will not getting saved.
Let me know.
Thank You! - May 5, 2020 at 9:08 pm #127093
verrouillage.ma
ParticipantYes of course the url is valid
when I save, the page validates in green, but when I reload the page the url disappears - May 5, 2020 at 9:58 pm #127106
Sushobhan
KeymasterHi,
In my setup it’s working fine. Not sure whats happening on your side. Obviously the data is not saving. But, WHY?
To debug this I’ll require to add some logs. Could you please provide me a temporary ftp access of your site? While doing so, don’t forget to mark it as private.
Thank You! - May 6, 2020 at 4:16 am #127193
verrouillage.ma
ParticipantThis reply has been marked as private. - May 6, 2020 at 10:56 pm #127637
Sushobhan
KeymasterSorry to give you trouble but I’ll require a vendor access as well!
Thank You! - May 7, 2020 at 9:20 am #127852
verrouillage.ma
ParticipantThis reply has been marked as private. - May 8, 2020 at 5:22 am #128200
verrouillage.ma
ParticipantThis reply has been marked as private. - May 8, 2020 at 11:39 am #128284
Sushobhan
KeymasterHello,
It’s done. While adding this snippet you have chosen Only run on site front-end, due to that the save hook callback was not firing. I have changed that to Run snippet everywhere. Now It’s working. Please check.
You can now disable/destroy the shared credentials.
Thank You! - May 10, 2020 at 5:06 am #129012
verrouillage.ma
ParticipantThank you verry mutsh for your help
you are the best
- May 10, 2020 at 3:15 pm #129138
Sushobhan
KeymasterYou 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 (if you haven’t already) 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 16, 2020 at 11:39 pm #141775
verrouillage.ma
ParticipantHello
I hope everyone is fine with you.
I would like to know if it is possible to create groups with catalog option only, no sales option?Thank you
- AuthorPosts
- You must be logged in to reply to this topic.