Conditional Badges

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 15 reply threads
  • Author
    Posts
    • #36184
      dominic.takaendisa
      Participant

      Hi,

      Thank you for the plugin it is really helpfull, very powerfull and saves me lots of time in programming. Great JOB guys!

      My current problem is that the Vendor Badges are only based on Membership or verification. And custom badges are manually added.
      Can you please tell me the following:

      1. In the Tutorial for badges you wrote that the conditional badges are coming soon. Can you please tell me when these will be available?I reaally need them. (Badges based on Nr of Sales, based on Reviews for example 3+ / 4+ / 5+ Reviews, No of published Products, Differentiating Completed Social/ National Verification automatically, etc. )
      2. Is it possible to provide all the badges (Verification and custom badges as select/check boxes) during the Vendor Approval/rejection popup? This is more Practical to assign custom badges during the approval process and not having to go through the manage vendor page.
      3. Is it Possible to provide all possible badges as selct of check boxes in the Prompt verification page of the Vendor as well? This way he can submit a promt verification incl. the custom badges he is interested in.

      One last thing although this has to do with products and not the Badges.
      Is it possible to provide options to display the Product Custom fields. At the moment i can only choose between after title, after cart etc.
      It would be great if i could also choose the font size/colour and to display the fields and values next to each other with one column, two columns or three columns. (This way custom product fields dont take up so much space and scrolling down the page.)

      Really appreciate your response and help.

    • #36280
      dominic.takaendisa
      Participant

      Hi

      do have any update to this question?

      Thanks in Advance

    • #36282
      WCFM Forum
      Keymaster

      hi,

      we are working on this feature and will be there very soon.

      in fact it will be just after wcfm rest api.

      i will update you on this.

      thank you

    • #36287
      Dee
      Guest

      Hi thanks looking forward to it. What about this?

      Is it possible to provide options to display the Product Custom fields. At the moment i can only choose between after title, after cart etc.
      It would be great if i could also choose the font size/colour and to display the fields and values next to each other with one column, two columns or three columns. (This way custom product fields dont take up so much space and scrolling down the page.)

    • #36325
      WCFM Forum
      Keymaster

      Hi,

      Kindly show me an idea, how you want to display custom field?

      I will give code for that.

      Thank You

    • #36646
      dominic.takaendisa
      Participant

      Hi

      i have made a picture with PAINT of how the product Custom fields look now (under each other) and another picture with PAINT of how i need the Custom fields to look next to each other.

      In the picture the example shows 3 columns of the custom fields next to each other.
      Please provide me the code and please tell me where i should insert the code so that it doesnt interfere with future updates.

      Thank you

      Attachments:
      You must be logged in to view attached files.
    • #36892
      WCFM Forum
      Keymaster

      HI,

      Thanks for the drawing.

      I will send you code for this.

      Thank You

    • #37509
      Dominic
      Guest

      Hi,

      Thank you.
      Am still waiting on the code. I hope you havent forgotten me 😀

      Cheers

    • #38011
      WCFM Forum
      Keymaster

      Ahh .. really sorry.

      I will send you that tomorrow morning.

      Thanks for your patience.

    • #38178
      Dominic
      Guest

      Hi

      Are you still sending the Code today?
      Been waiting for it all day?

    • #38451
      WCFM Forum
      Keymaster

      Hi,

      Sorry for the delay, here is your code for the purpose –

      function get_wcfm_custom_field_2811_display_data( $product_id, $wcfm_product_custom_field ) {
      	global $WCFM, $product, $post;
      	
      	$display_data = '';
      	$block_name = !empty( $wcfm_product_custom_field['block_name'] ) ? $wcfm_product_custom_field['block_name'] : '';
      	if( !$block_name ) return '';
      	$exclude_product_types = isset( $wcfm_product_custom_field['exclude_product_types'] ) ? $wcfm_product_custom_field['exclude_product_types'] : array();
      	$is_group = !empty( $wcfm_product_custom_field['group_name'] ) ? 'yes' : 'no';
      	$is_group = !empty( $wcfm_product_custom_field['is_group'] ) ? 'yes' : 'no';
      	$group_name = $wcfm_product_custom_field['group_name'];
      	$group_value = array();
      	$group_value = (array) get_post_meta( $product_id, $group_name, true );		
      	$group_value = apply_filters( 'wcfm_custom_field_group_data_value', $group_value, $group_name );
      	
      	$product = wc_get_product( $product_id );
      	$product_type = $product->get_type();
      	
      	$wcfm_product_custom_block_fields = $wcfm_product_custom_field['wcfm_product_custom_block_fields'];
      	if( !empty( $wcfm_product_custom_block_fields ) && !in_array( $product_type, $exclude_product_types ) ) {
      		
      		$vendor_id = $WCFM->wcfm_vendor_support->wcfm_get_vendor_id_from_product( $product_id );
      		if( $vendor_id ) {
      			if( !$WCFM->wcfm_vendor_support->wcfm_vendor_allowed_element_capability( $vendor_id, 'allowed_custom_fields', sanitize_title($block_name) ) ) return;
      		}
      		
      		$display_data .= '<div class="wcfm_custom_field_display wcfm_custom_field_display_'.sanitize_title($block_name).'">';
      		if( $block_name && apply_filters( 'wcfm_is_allow_custom_field_block_name_display', true ) ) {
      			$display_data .= "<h4 class='wcfm_custom_field_display_heading'>" . __( $block_name, 'wc-frontend-manager' ) . "</h4>";
      		}
      		$display_data .= "<table class='wcfm_custom_field_display_table' border='1'><tr>";
      		foreach( $wcfm_product_custom_block_fields as $wcfm_product_custom_block_field ) {
      			if( !$wcfm_product_custom_block_field['name'] ) continue;
      			$field_value = '';
      			$field_name = $wcfm_product_custom_block_field['name'];
      			if( $is_group == 'yes' ) {
      				$field_name = $group_name . '[' . $wcfm_product_custom_block_field['name'] . ']';
      				if( $product_id ) {
      					if( $wcfm_product_custom_block_field['type'] == 'checkbox' ) {
      						$field_value = isset( $group_value[$wcfm_product_custom_block_field['name']] ) ? 'yes' : 'no';
      					} elseif( $wcfm_product_custom_block_field['type'] == 'upload' ) {
      						if( isset( $group_value[$wcfm_product_custom_block_field['name']] ) ) {
      							$field_value = '<a href="'.$group_value[$wcfm_product_custom_block_field['name']].'" target="_blank">' . __( 'Check here', 'wc-frontend-manager-ultimate' ) . '</a>';
      						}
      					} else {
      						if( isset( $group_value[$wcfm_product_custom_block_field['name']] )) {
      							$field_value = $group_value[$wcfm_product_custom_block_field['name']];
      						}
      					}
      				}
      			} else {
      				if( $product_id ) {
      					if( $wcfm_product_custom_block_field['type'] == 'checkbox' ) {
      						$field_value = get_post_meta( $product_id, $field_name, true ) ? get_post_meta( $product_id, $field_name, true ) : 'no';
      					} elseif( $wcfm_product_custom_block_field['type'] == 'upload' ) {
      						if( get_post_meta( $product_id, $field_name, true ) ) {
      							$field_value = '<a href="'.get_post_meta( $product_id, $field_name, true ).'" target="_blank">' . __( 'Check here', 'wc-frontend-manager-ultimate' ) . '</a>';
      						}
      					} else {
      						$field_value = get_post_meta( $product_id, $field_name, true );
      					}
      				}
      			}
      			
      			if( !$field_value ) continue;
      			
      			$display_data .= "<td>";
      			$display_data .= "<label class='wcfm_custom_field_display_label'>" . __( $wcfm_product_custom_block_field['label'], 'wc-frontend-manager') . "</label>: ";
      			$display_data .= "<br />";
      			$display_data .= "<span class='wcfm_custom_field_display_value'>" . $field_value . "</span><br />";
      			$display_data .= "</td>";
      		}
      		$display_data .= "</tr></table>";
      		$display_data .= '</div>';
      	}
      	return $display_data;
      }
      function wcfm_custom_field_2811_display_after_title() {
      	global $WCFM, $product, $post;
      
      	$product_id = 0;
      	if ( is_object( $product ) ) { 
      		$product_id   		= $product->get_id(); 
      	} else if ( is_product() ) {
      		$product_id   		= $post->ID;
      	}
      		
      	if( $product_id ) {
      		$wcfm_product_custom_fields = (array) get_option( 'wcfm_product_custom_fields' );
      		if( $wcfm_product_custom_fields && is_array( $wcfm_product_custom_fields ) && !empty( $wcfm_product_custom_fields ) ) {
      			foreach( $wcfm_product_custom_fields as $wpcf_index => $wcfm_product_custom_field ) {
      				if( !isset( $wcfm_product_custom_field['enable'] ) ) continue;
      				
      				$display_data = get_wcfm_custom_field_2811_display_data( $product_id, $wcfm_product_custom_field );
      				echo $display_data;
      			}
      		}
      	}
      }
      add_action( 'woocommerce_single_product_summary',	'wcfm_custom_field_2811_display_after_title',  7 );

      Well, for custom fields setting panel set “visibility” = “Do not display”.

      This will generate such a display – https://ibb.co/jTrTvSp

      Thank You

    • #38525
      dominic.takaendisa
      Participant

      Thank you for the code.

      Please tell me where to insert it. At the moment i inserted it into my core files for the Plugin:

      class-wcfmu-customfield-support.php -> Unfortunately its not working Eror 500 on my site.

      AND if i insert the codse here I#m sure i will lose it as soon as you make an update to the WCFM Ultimate plugin.
      Can I insert it some where else? Ps I do not have a Child Theme.

      I Have attached thecore file here

    • #38526
      dominic.takaendisa
      Participant

      Thank you for the code.

      Please tell me where to insert it. At the moment i inserted it into my core files for the Plugin:

      class-wcfmu-customfield-support.php -> Unfortunately its not working Eror 500 on my site.

      AND if i insert the codse here I#m sure i will lose it as soon as you make an update to the WCFM Ultimate plugin.
      Can I insert it some where else? Ps I do not have a Child Theme.

      I Have attached thecore file here

      Attachments:
      You must be logged in to view attached files.
    • #38529
      WCFM Forum
      Keymaster

      Hi,

      Kindly add this code to your child theme’s functions.php

      Please do not edit any WCFM core plugins.

      Thank You

    • #38563
      dominic.takaendisa
      Participant

      Hi

      Thank you! I installed created the Child theme and inserted the code.
      It is working well but there is one small problem I cannot figure out.

      The semi colon “;” is not being displayed correctly next to the cutom field name.
      Do you know where the problem is? I have attached a picture for you to see what i mean.

      Actually the problem also exists in a similar way in the original wcfm code. (see the second pic.)

      Thanks a lot for your response!

      Attachments:
      You must be logged in to view attached files.
    • #38584
      WCFM Forum
      Keymaster

      HI,

      Change this line -> $display_data .= “: “;

      To this in custom code ->

      $display_data .= "<label class='wcfm_custom_field_display_label'>" . __( $wcfm_product_custom_block_field['label'], 'wc-frontend-manager') . ": </label>";

      Thank You

Viewing 15 reply threads
  • The topic ‘Conditional Badges’ is closed to new replies.