Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WCFM – Ultimate › Conditional Badges
Tagged: Badges, Custom-product-fields
- This topic has 15 replies, 3 voices, and was last updated 5 years, 11 months ago by WCFM Forum.
- AuthorPosts
- November 9, 2018 at 12:28 am #36184dominic.takaendisaParticipant
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.
- November 10, 2018 at 10:33 am #36280dominic.takaendisaParticipant
Hi
do have any update to this question?
Thanks in Advance
- November 10, 2018 at 12:53 pm #36282WCFM ForumMember
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
- November 10, 2018 at 3:07 pm #36287DeeGuest
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.) - November 11, 2018 at 7:28 am #36325WCFM ForumMember
Hi,
Kindly show me an idea, how you want to display custom field?
I will give code for that.
Thank You
- November 13, 2018 at 8:51 pm #36646dominic.takaendisaParticipant
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. - November 17, 2018 at 5:40 am #36892WCFM ForumMember
HI,
Thanks for the drawing.
I will send you code for this.
Thank You
- November 22, 2018 at 11:42 am #37509DominicGuest
Hi,
Thank you.
Am still waiting on the code. I hope you havent forgotten me 😀Cheers
- November 25, 2018 at 6:18 pm #38011WCFM ForumMember
Ahh .. really sorry.
I will send you that tomorrow morning.
Thanks for your patience.
- November 26, 2018 at 6:47 pm #38178DominicGuest
Hi
Are you still sending the Code today?
Been waiting for it all day? - November 28, 2018 at 5:23 am #38451WCFM ForumMember
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
- November 28, 2018 at 1:06 pm #38525dominic.takaendisaParticipant
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
- November 28, 2018 at 1:09 pm #38526dominic.takaendisaParticipant
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. - November 28, 2018 at 1:26 pm #38529WCFM ForumMember
Hi,
Kindly add this code to your child theme’s functions.php
Please do not edit any WCFM core plugins.
Thank You
- November 28, 2018 at 9:47 pm #38563dominic.takaendisaParticipant
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. - November 29, 2018 at 10:16 am #38584WCFM ForumMember
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
- AuthorPosts
- The topic ‘Conditional Badges’ is closed to new replies.