Vendor store page tabs-Need Code adjustment

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!

Viewing 7 reply threads
  • Author
    Posts
    • #138024
      hani
      Participant

      Hi,

      Would you please provide me adjusted code to feed the template of a new tab in vendor store page from new registration fields.I created new field in the vendor registration form.

      add_action( ‘wcfmmp_rewrite_rules_loaded’, function( $wcfm_store_url ) {
      add_rewrite_rule( $wcfm_store_url.’/([^/]+)/art_works?$’, ‘index.php?’.$wcfm_store_url.’=$matches[1]&art_works=true’, ‘top’ );
      add_rewrite_rule( $wcfm_store_url.’/([^/]+)/art_works/page/?([0-9]{1,})/?$’, ‘index.php?’.$wcfm_store_url.’=$matches[1]&paged=$matches[2]&art_works=true’, ‘top’ );
      }, 50 );

      add_filter( ‘query_vars’, function( $vars ) {
      $vars[] = ‘art_works’;
      return $vars;
      }, 50 );

      add_filter( ‘wcfmmp_store_tabs’, function( $store_tabs, $store_id ) {
      $store_tabs[‘art_works’] = ‘Art Works’;
      return $store_tabs;
      }, 50, 2 );

      add_filter( ‘wcfmp_store_tabs_url’, function( $store_tab_url, $tab ) {
      if( $tab == ‘art_works’ ) {
      $store_tab_url .= ‘art_works’;
      }
      return $store_tab_url;
      }, 50, 2 );

      add_filter( ‘wcfmp_store_default_query_vars’, function( $query_var ) {
      global $WCFM, $WCFMmp;

      if ( get_query_var( ‘art_works’ ) ) {
      $query_var = ‘art_works’;
      }
      return $query_var;
      }, 50 );

      add_filter( ‘wcfmmp_store_default_template’, function( $template, $tab ) {
      if( $tab == ‘art_works’ ) {
      $template = ‘store/wcfmmp-view-store-art-works.php’;
      }
      return $template;
      }, 50, 2);

    • #138100
      hani
      Participant

      Can someone answer? i feel answers are only for specific topics

    • #138262

      Hello,

      You have already the demo code on how to add “new tab” in vendor’s store page.
      Replace the “art_works” as per your require slug, and in “wcfmmp-view-store-art-works.php” file write below code to get “custom fields value”-

      $wcfmvm_custom_infos = (array) get_user_meta( $vendor_id, 'wcfmvm_custom_infos', true ); //get all custom field data 
      	if( !empty( $wcfmmp_addition_info_fields ) ) {
      		foreach( $wcfmmp_addition_info_fields as $wcfmvm_registration_custom_field ) {
      			if( !isset( $wcfmvm_registration_custom_field['enable'] ) ) continue;
      			if( !$wcfmvm_registration_custom_field['label'] ) continue;
      			
      			$field_class = '';
      			$field_value = '';
      			
      			$wcfmvm_registration_custom_field['name'] = sanitize_title( $wcfmvm_registration_custom_field['label'] );
      			$field_name = 'wcfmmp_additional_infos[' . $wcfmvm_registration_custom_field['name'] . ']';
      			$field_id   = md5( $field_name );
      			$ufield_id  = '';
      		
      			if( !empty( $wcfmvm_custom_infos ) ) {
      				$field_value = isset( $wcfmvm_custom_infos[$wcfmvm_registration_custom_field['name']] ) ? $wcfmvm_custom_infos[$wcfmvm_registration_custom_field['name']] : '';
      					echo $wcfmvm_registration_custom_field['label'].' '.$field_value;
      				} 
      			}
      			
      		}
      	}

      Thanks.

    • #138326
      hani
      Participant
      This reply has been marked as private.
    • #138876
      hani
      Participant
      This reply has been marked as private.
    • #138878
      hani
      Participant

      Another Attachment

      Attachments:
      You must be logged in to view attached files.
    • #138902

      Hello,

      Add the condition –

      
      if($wcfmvm_registration_custom_field_key == 'approvals') {}

      Thanks.

    • #138912
      hani
      Participant
      This reply has been marked as private.
Viewing 7 reply threads
  • You must be logged in to reply to this topic.