wcfm-santa

A deal you can't resist! Get upto 35% Off on this entire cyber week.

CLAIM OFFER
01Day 21Hr 00Min 47Sec
wcfm-santa

WCFM registration form custom field display on vendor page

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!

Multi Vendor Marketplace Plugin | WCFM Marketplace Forums WCFM – Membership WCFM registration form custom field display on vendor page

Viewing 7 reply threads
  • Author
    Posts
    • #125378
      bigbidro
      Participant

      I want to display custom field from registration form to the vendor page. I’v seen that it can be done using short code like [wcfm_store_info data=”wcfmvm_registration_custom_field_0″].
      My problem is that i don’t know the field name created by wcfm, as i’m not aloowed to give “name” to the custom field on registration page. How can i get the custom field name?
      Please help!

    • #125511
      bigbidro
      Participant

      I tested some more and the shortcode method works for displaying the Text custom field, but it doesn’t work for the File/Image custom field. Is there anything i’m missing? Can someone give me some hint, how can i achieve this: Image registration custom field displayed on vendor page????

      I want to display the Image on the About us Tab. I have manage to get everything working, except for the image being show up: https://butic.transatravel.ro/fermier/producator-bocii-gheorghe/despre

    • #125691
      bigbidro
      Participant

      The custom image field is showing on the More Info in the dashboard. That means that it can be used on the vendors page either. Just don’t know how to do it.
      Some help here?
      Thank you!

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

      Hello,

      To display file/upload custom field in vendor’s store page (about tab),Try 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_after_about','additonal_info_wcfmmp_store_after_about');
      function additonal_info_wcfmmp_store_after_about($vendor_id) {
      	global $WCFM, $WCFMmp, $wpdb;
      		
      	$wcfmmp_addition_info_fields = wcfm_get_option( 'wcfmvm_registration_custom_fields', array() );
      	if( empty( $wcfmmp_addition_info_fields ) ) return;
      	
      	$has_addition_field = false;
      	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;
      			$has_addition_field = true;
      			break;
      		}
      	}
      	if( !$has_addition_field ) return;
      	$wcfmvm_custom_infos = (array) get_user_meta( $vendor_id, 'wcfmvm_custom_infos', true );
      	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 ) ) {
      				if( $wcfmvm_registration_custom_field['type'] == 'upload' ) {
      					$ufield_id = md5( 'wcfmvm_custom_infos[' . sanitize_title( $wcfmvm_registration_custom_field['label'] ) . ']' );
      					$field_value = isset( $wcfmvm_custom_infos[$ufield_id] ) ? $wcfmvm_custom_infos[$ufield_id] : '';
      					$field_value = wcfm_get_attachment_url($field_value);
      					echo '<img src="'.$field_value.'" />';
      				} 
      			}
      			
      		}
      	}					
      
      }

      Thanks.

    • #126113
      bigbidro
      Participant

      Thank you for your time!
      Although the snippet works, i want to pull every file separately, to have it display in a more elegant way. See my atached file.
      I created a custom wcfmmp-view-store-about.php in child theme /wcfm/store.
      There will be two image custom fields on the registration form, each image showing up in its own div on the About Tab.

      <div class="autorizatii policies_area">
        <div class="col-lg-12 col-md-12 col-sm-12 widget-title">
          <h4><small>AUTORIZAȚII</small></h4>
        </div>
        <div class="col-lg-6 col-md-6 col-sm-12">
          <h5 class="sec-title"><small>Certificat de Înregistrare</small></h5>
          <?php echo do_shortcode( '[wcfm_store_info data="numar-certificat-de-inregistrare"]' ); ?> </div>
        <div class="col-lg-6 col-md-6 col-sm-12" >
          <h5 class="sec-title"><small>Autorizație Sanitar-Veterinară</small></h5>
          <?php echo do_shortcode( '[wcfm_store_info data="numar-autorizatie-sanitar-veterinara"]' ); ?> </div>
      </div>

      I tried using the short code, but is not working for images. Help on this would be highly appreciated.
      Thank you!

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

      Hello,

      You can try the modified code,

      add_action('wcfmmp_store_after_about','additonal_info_wcfmmp_store_after_about');
      function additonal_info_wcfmmp_store_after_about($vendor_id) {
      	global $WCFM, $WCFMmp, $wpdb;
      		
      	$wcfmmp_addition_info_fields = wcfm_get_option( 'wcfmvm_registration_custom_fields', array() );
      	if( empty( $wcfmmp_addition_info_fields ) ) return;
      	
      	$has_addition_field = false;
      	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;
      			$has_addition_field = true;
      			break;
      		}
      	}
      	if( !$has_addition_field ) return;
      	$wcfmvm_custom_infos = (array) get_user_meta( $vendor_id, 'wcfmvm_custom_infos', true );
      	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 ) ) {
      				if( $wcfmvm_registration_custom_field['type'] == 'upload' ) {
      					$ufield_id = md5( 'wcfmvm_custom_infos[' . sanitize_title( $wcfmvm_registration_custom_field['label'] ) . ']' );
      					$field_value = isset( $wcfmvm_custom_infos[$ufield_id] ) ? $wcfmvm_custom_infos[$ufield_id] : '';
      					$field_value = wcfm_get_attachment_url($field_value);
      					?>
      					<div class="addi_info_img_block" style="width:49%;display:inline-block;vertical-align:top;">
      						<h4><small><?php echo $wcfmvm_registration_custom_field['label']; ?></small></h4>
      						<img src="<?php echo $field_value; ?>" />
      					</div>
      					
      					<?php
      				} 
      			}
      			
      		}
      	}					
      
      }

      Thanks.

    • #126640
      bigbidro
      Participant

      Thank you! That was exactly what i need it.
      You guys at WC Lovers are awesome.
      Topic can now be closed.
      Thank you so much!

    • #126887

      You are always welcome 🙂

      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.

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