Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WCFM › WCFM frontend manager plugin edit
- This topic has 12 replies, 3 voices, and was last updated 4 years, 6 months ago by Sarmistha Chakraborty.
- AuthorPosts
- June 5, 2020 at 11:18 am #138638
- June 5, 2020 at 2:19 pm #138717Sarmistha ChakrabortyMember
Hello,
You do not need to edit the core plugin. In our plugin have many hooks/filter.
Add this code to your child theme’s functions.php, to add your custom data –
add_action('begin_wcfm_products_manage_form',function(){ echo 'add your custom text'; });
Thanks.
- June 5, 2020 at 3:24 pm #138729
- June 5, 2020 at 3:47 pm #138739Sarmistha ChakrabortyMember
Hello,
You have mentioned you have write the shortcode.
To add a product custom field, our WCFM plugin has this feature in product tabs.
Admin WCFM dashboard -> Settings -> Product custom fieldsThanks.
Attachments:
You must be logged in to view attached files. - June 5, 2020 at 4:12 pm #138748brevaloParticipant
Yes I know about Product custom field and this is really helpful, but I am trying to do little bit different thing.
I want to add choice buttons above the “simple product” field as shown in screenshot:
Big thanks for your help.
Attachments:
You must be logged in to view attached files. - June 5, 2020 at 11:12 pm #138915Sarmistha ChakrabortyMember
Hello,
add_action('begin_wcfm_products_manage_form',function(){ global $wp, $WCFM; $buysell_val = ''; $product_id = 0; if( isset( $wp->query_vars['wcfm-products-manage'] ) && !empty( $wp->query_vars['wcfm-products-manage'] ) ) { $product = wc_get_product( $wp->query_vars['wcfm-products-manage'] ); if( !is_a( $product, 'WC_Product' ) ) { wcfm_restriction_message_show( "Invalid Product" ); return; } // Fetching Product Data if($product && !empty($product)) { $product_id = $wp->query_vars['wcfm-products-manage']; $buysell_val = get_post_meta($product_id,'_product_buysell',true); } } ?> <p>What do you want to do?</p> <input type="radio" id="buy" name="buysell" value="buy" <?php echo ($buysell_val == "buy") ? 'checked="checked"' : ''; ?>> <label for="buy">Buy</label> <input type="radio" id="sell" name="buysell" value="sell" <?php echo ($buysell_val == "sell") ? 'checked="checked"' : ''; ?>> <label for="sell">Sell</label><br> <?php }); add_action( 'after_wcfm_products_manage_meta_save', 'fn_custom_product_data_save',10,2 ); function fn_custom_product_data_save($new_product_id, $wcfm_products_manage_form_data) { global $wpdb; //print_r($wcfm_products_manage_form_data);die; if(isset($wcfm_products_manage_form_data['buysell'])) { update_post_meta($new_product_id,'_product_buysell',$wcfm_products_manage_form_data['buysell']); } }
Add 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/
Thanks. - June 6, 2020 at 3:37 pm #139045brevaloParticipant
Ok, I’ve fixed the problem!
Everything is working.
Now, Can we do so that “buy” and “sell” choice make required and also when the vendor adds the product in the product listing mentioned “for sale” or “for buying”.
- June 6, 2020 at 9:42 pm #139127Sarmistha ChakrabortyMember
Great!
Can we do so that “buy” and “sell” choice make required
>>Modify the HTML –<p>What do you want to do?</p> <input type="radio" id="buy" name="buysell" value="buy" <?php echo ($buysell_val == "buy") ? 'checked="checked"' : ''; ?> data-required="1" data-required_message="What do you want to do: This field is required."> <label for="buy">Buy</label> <input type="radio" id="sell" name="buysell" value="sell" <?php echo ($buysell_val == "sell") ? 'checked="checked"' : ''; ?> > <label for="sell">Sell</label><br>
Display in product list –
add_filter( 'wcfm_products_additonal_data_hidden', '__return_false' ); add_filter('wcfm_products_additonal_data',function($product_data,$product_id){ $product_data = get_post_meta($product_id,'_product_buysell',true); return $product_data; },10,2); add_filter('wcfm_products_additional_info_column_label',function($lbl){ return 'What do you want to do'; },10);
Thanks.
- June 14, 2020 at 5:15 pm #141276meyouParticipantThis reply has been marked as private.
- June 17, 2020 at 9:03 pm #142022Sarmistha ChakrabortyMember
Hello,
how can I add a label to featured image? Something like “Upload Image” for the featured Image, and “Add more Image” label for more images?.
>> Add this code in your theme’s functions.php –add_filter('wcfm_product_manage_fields_images',function($fields){ $fields['featured_img']['label'] = 'Upload Image'; $fields['gallery_img']['label'] = 'Add more Image'; return $fields; });
where can I locate the html page for the toggle menu, would love to turn the 3 bars into a X when it is clicked
>>For this you need to override “wcfm-view-header-panels.php” in your theme folder<your theme folder>/wcfm/wcfm-view-header-panels.php
from \wp-content\plugins\wc-frontend-manager\views\wcfm-view-header-panels.php.
And then you will find the Toggle menu section –
<span class="wcfm_menu_toggler wcfmfa fa-bars text_tip" data-tip="<?php _e( 'Toggle Menu', 'wc-frontend-manager' ); ?>"></span>
Thanks.
- June 18, 2020 at 12:57 pm #142171meyouParticipantThis reply has been marked as private.
- June 20, 2020 at 8:33 pm #142805Sarmistha ChakrabortyMember
Hi,
We can guide you, it will need some javascript and css knowledge.
Please check this link – https://www.sanwebcorner.com/2016/12/onclick-change-mobile-menu-three-bar.htmlThanks.
- AuthorPosts
- You must be logged in to reply to this topic.