Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WCFM – Membership › WCFM registration form custom field display on vendor page
- This topic has 7 replies, 2 voices, and was last updated 4 years, 6 months ago by Sarmistha Chakraborty.
- AuthorPosts
- May 1, 2020 at 3:41 pm #125378bigbidroParticipant
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! - May 1, 2020 at 10:21 pm #125511bigbidroParticipant
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
- May 2, 2020 at 4:02 pm #125691
- May 3, 2020 at 1:34 pm #125959Sarmistha ChakrabortyMember
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.
- May 3, 2020 at 6:59 pm #126113bigbidroParticipant
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. - May 4, 2020 at 2:45 pm #126420Sarmistha ChakrabortyMember
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.
- May 4, 2020 at 11:21 pm #126640bigbidroParticipant
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! - May 5, 2020 at 1:52 pm #126887Sarmistha ChakrabortyMember
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.
- AuthorPosts
- You must be logged in to reply to this topic.