• Resolved Kir 2012

    (@kir-2012)


    Hi there,

    I would like my vendors to be able to select from a certain role type (eg Producers), via a custom field on the ‘add product’ page in vendor dashboard, to be able to display that Producer’s own user page as a linked avatar on their product page, has this come up before?

    To make sure I do a good enough job of explaining what I mean:

    If half of my users were ‘vendors’ role and half ‘Producers’ (I need Producers as a user role, but it’s relevant to display this info as link from the product page also, because it helps to explain the value of the listed product).

    So I would like the vendor role who lists the product in the front end dashboard, to be able to choose these producers from all available under that role. I need the vendor to have a field where they can type into a multi-select box which pulls the data up from role type ‘Producers’ in the user database, and add each relevant user they wish to show, and then click save to add the selected users of Producers role to display on their product page with a linked avatar.

    Has anything similar come up before?

    Is there a plugin that could help do this or a starting point?

    Kind regards

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Support mouindi

    (@mouindi)

    Hello @kir-2012,

    It’s great to hear from you, and I hope everything is going well.

    If I understand correctly, you’d like each vendor to be able to choose a producer for each of their products. In this scenario, on the product page, the product would be linked to the chosen producer, with a URL redirecting to the producer’s page.

    In that case, as of now, the platform doesn’t have built-in functionality for this specific flow. However, it is possible to achieve this with some custom code. Do you have a developer on your team? If so, we can provide coding guidance on implementing this feature.

    Looking forward to your response.

    Thread Starter Kir 2012

    (@kir-2012)

    Hi there hope you are very well and thanks for coming back to me – in answer to your questions:

    – Yes you’ve got it exactly right: the vendor should use a multi-selector when they are adding their product page, to call up from user role ‘Producer’, to display their linked avatar at the product page.

    – Yes, and that would be great if you could provide that guidance

    Kind thanks for your help ??

    Plugin Support mouindi

    (@mouindi)

    @kir-2012, here are the hook/filter list for this :

    Add-product page
    Add field hook in add product = ‘mvx_after_product_excerpt_metabox_panel’
    Save hook to add the data for the product = ‘mvx_process_product_object’

    single-product page filter to display the data = ‘woocommerce_product_tabs’

    Thread Starter Kir 2012

    (@kir-2012)

    Hi, thanks for this, I’m using an older version of WCMP just for now but I recognised the code from some tabs I’ve added successfully, thanks for the pointer.

    So I’ve added the tab, but for this tab, I don’t seem to be saving the data successfully, I would expect to hit save, and then see my selections from the multi-select box showing there still, present in the dashboard form as I do with the other tabs I’ve added (one of the other tabs I’ve added already is for ‘from and to’ dates, and they remain selected after saving, and the other tab is for an image upload, which also remains present after saving.

    Here is my code, – for the tab content, using PODS I’ve created the multi-select form. I have created a relationship field whats_on https://docs.pods.io/fields/relationship/ for products (or tickets in my case), to create a relationship between products/tickets and ‘users’ – so what you’re picking here as a vendor in the dashboard via field whats_on , are other users.

    The code below in the content tab creates the front end form for my user. (As per their quick guide here: https://docs.pods.io/code/pods/form/).

    The form seems to work fine, the vendor selects their user, but then the data doesn’t appear to save at all. Can you see my problem in the code?

    Kind thanks

    /**
    * Add Custom Tab
    * @Version 3.3.0
    */
    function add_custom_product_data_tabs_3( $tabs ) {
       $tabs['more'] = array(
           'label'    => __( 'More Stuff...', 'more-stuff' ),
           'target'   => 'see-more',
           'class'    => array(),
           'priority' => 100,
       );
       return $tabs;
    }
    add_filter( 'wcmp_product_data_tabs', 'add_custom_product_data_tabs_3' );
    
    
    /**
    * Add Custom Tab Content
    */
    function add_custom_product_data_content_3( $pro_class_obj, $product, $post ) {
        //prnt_r($product->get_id());die;
        $hh = get_post_meta($product->get_id() , 'whats_on' );
    
        //print_r($hh);
       ?>
          <div role="tabpanel" class="tab-pane fade" id="see-more"> <!-- just make sure tabpanel id should replace with your added tab target -->
           <div class="row-padding">
               <div class="form-group">
                   <label class="control-label col-sm-3 col-md-3">More Info:</label>
                   <div class="col-md-6 col-sm-9">
                     //start of the pods form
    <?php
    $pods = pods( 'product' );
    $params = array( 'fields_only' => true, 'fields' => array('whats_on') );
    echo $pods->form( $params );?>
    
     //end of the pods form
                    
                   </div>
               </div>
           </div>
       </div>
       <?php
    }
    add_action( 'wcmp_product_tabs_content', 'add_custom_product_data_content_3', 10, 3 );
    
    
    
    /**
    * Save Custom Tab content
    */
    function save_custom_product_data_3( $product, $post_data ) {
       if( isset($post_data['post_ID']) && isset($post_data['whats_on'])){
           update_post_meta( absint( $post_data['post_ID'] ), 'whats_on', $post_data['whats_on']);
       }
    }
    add_action( 'wcmp_process_product_object', 'save_custom_product_data_3', 10, 2 );
    
    Plugin Support mouindi

    (@mouindi)

    Hi @kir-2012,

    We regret to inform you that starting from October 2023, we no longer provide support for WC Marketplace.

    Therefore, we kindly ask you to migrate to MultiVendorX. Rest assured, you won’t lose any data during the migration process.

    We have created a comprehensive tutorial to assist you with the migration. Here is the link: https://www.youtube.com/watch?v=E6ZPznJ2Hew

    Thread Starter Kir 2012

    (@kir-2012)

    I previously bought your advanced front end product manager add on, , which I use with my installation – is it possible to achieve the same thing if I migrate? Without being billed hundreds of dollars every year?

    Plugin Support mouindi

    (@mouindi)

    Hi?@kir-2012, as per www.remarpro.com policy, we can’t provide information regarding paid plugins.

    Please contact use here : https://multivendorx.com/contact-us/

    Thread Starter Kir 2012

    (@kir-2012)

    I think you can answer with a simple yes or no…..
    Thanks

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Vendor pick users of certain role via custom field to display at product page’ is closed to new replies.