URL adresse web site vendor

We're shifting our Forum based support to a more dedicated support system!

We'll be closing our Forum support from 10th June, 2020 and move to Email Support assistance.

  • If you are a WCFM premium add-ons user, contact us- here
  • Want to know more before buying our add-ons? Send Pre sale queries- here
  • If you are a WCFM free user, please open a support ticket at WordPress.org
  • For WCFM App related queries, reach us- here
From now the forum will be read-only!

Tagged: 

Viewing 21 reply threads
  • Author
    Posts
    • #123401
      Avatarverrouillage.ma
      Participant

      Hello,
      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 possible

      Thank you

    • #123556
      AvatarSushobhan
      Keymaster

      Hi,
      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.

    • #124377
      Avatarverrouillage.ma
      Participant

      Hello
      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 you

      Attachments:
      You must be logged in to view attached files.
    • #124381
      AvatarSushobhan
      Keymaster

      Are 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?

    • #124406
      Avatarverrouillage.ma
      Participant

      no 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

    • #124542
      AvatarSushobhan
      Keymaster

      Hello,
      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.

    • #124720
      Avatarverrouillage.ma
      Participant

      yes i use WCFM groups and staph

    • #125125
      AvatarSushobhan
      Keymaster

      Hello,
      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!

    • #126228
      Avatarverrouillage.ma
      Participant

      Thank 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

    • #126335
      AvatarSushobhan
      Keymaster

      Hello,
      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/gNp8cpV

      Thank You!

    • #126770
      Avatarverrouillage.ma
      Participant

      good morning dear friend
      as you said everything is ok
      but when we add the website address the store does not save the address

    • #126814
      AvatarSushobhan
      Keymaster

      Hi,
      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!

    • #127093
      Avatarverrouillage.ma
      Participant

      Yes of course the url is valid
      when I save, the page validates in green, but when I reload the page the url disappears

    • #127106
      AvatarSushobhan
      Keymaster

      Hi,
      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!

    • #127193
      Avatarverrouillage.ma
      Participant
      This reply has been marked as private.
      • #127877
        AvatarSushobhan
        Keymaster
        This reply has been marked as private.
    • #127637
      AvatarSushobhan
      Keymaster

      Sorry to give you trouble but I’ll require a vendor access as well!
      Thank You!

    • #127852
      Avatarverrouillage.ma
      Participant
      This reply has been marked as private.
    • #128200
      Avatarverrouillage.ma
      Participant
      This reply has been marked as private.
    • #128284
      AvatarSushobhan
      Keymaster

      Hello,
      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!

    • #129012
      Avatarverrouillage.ma
      Participant

      Thank you verry mutsh for your help

      you are the best

    • #129138
      AvatarSushobhan
      Keymaster

      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 (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.

    • #141775
      Avatarverrouillage.ma
      Participant

      Hello
      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

Viewing 21 reply threads
  • You must be logged in to reply to this topic.