Banner Logo

Be a part of the family: Connect, Receive Support,
Contribute, and Reap Abundant Rewards

Way to display and filter by vendor instead of product

MultivendorX Pro

Resolved
Viewing 34 reply threads
  • Author
    Posts
    • #194642
      Nathan Wolhendler
      Participant

      On my marketplace I want to be able to display the vendor stores as the first display and once. clicked inside you can see the products being offered (instead of filtering by product from all vendors. How can I do this?

    • #194692
      Nathan Wolhendler
      Participant

      Any update on this?

    • #194693

      Hi, by default WooCommerce by default displays only products.
      So, as a solution, you can create a page that will show all the vendors in a list using this shortcode : [mvx_vendorslist orderby=”registered” order=”ASC”]

      Once user will select the vendor, they will be directed to that vendor’s shop page.

      Let us know if you need any further help.

    • #194698
      Nathan Wolhendler
      Participant

      I need to be able to filter the vendors by category and that the list should update dynamically.
      Using this we cannot filter. Any other solution?

    • #194706
      Nathan Wolhendler
      Participant

      or a possible widget to make this work?

    • #194718

      You can use our category wise vendor list short code in order to have a list with all of your vendors and let your customers have the possibility to filter vendors as per category –

      
       [mvx_vendorslist orderby=”category”]
      
      Copy

      I think this would be able to help you out.

    • #194720
      Nathan Wolhendler
      Participant

      This is good for orderby but is there a way to use this short-code and filter by category and location? So I only see the vendors let’s say in food and usa?

    • #194721
      Nathan Wolhendler
      Participant

      also is there a way to customise what this looks like and what is shown (now it is showing. top. selling products but I dont want that

    • #194743

      @Nathan In the vendor list page there is already an option for the users to search for vendors by putting address or distance https://prnt.sc/yoaJ2bGBtGaj.
      Now if you want to customize the page then you will have to add custom code for that.
      For example, if you add the below code in the functions.php file of you current active theme then the top products section will be removed –

      
      add_action( 'init', 'remove' );
       function remove() {  
        remove_action( 'mvx_vendor_lists_vendor_top_products', 'mvx_vendor_lists_vendor_top_products' );
      }
      
      Copy
    • #194755
      Nathan Wolhendler
      Participant

      that’s great is there a way to filter / sort by a custom field?

    • #194762

      @Nathan Wolhendler I am afraid but there is no such short code using which you can filter vendors by custom field on the vendor list page.
      However, you can do custom code and add this support for your site. If you need a reference of hook/filter, let us know.

    • #194807
      Nathan Wolhendler
      Participant

      Yes please, so we need a hook/filter that can generate a gallery of vendors filtered by location and another filtered by category of products offered

    • #194825

      There are already options to filter vendors by products category and also search for vendors according to location on the vendor list page. Kindly check the video https://watch.screencastify.com/v/yX59XesT3hZiPGQF84hc.
      If you need any further help, please do not hesitate to ask.

    • #194840
      Nathan Wolhendler
      Participant

      yes, I want to be able to display only 1 category of vendors per category view (ex show all the vendors for women on the womens page and all the vendors. for baby. on the baby page) how can I do that?

    • #194860
      Nathan Wolhendler
      Participant

      any update on this, also our location is a custom field that is by neighborhood, so we would need to created filtered views by category. and this custom location field

    • #194863

      @Nathan Wolhendler
      Our team is looking into this. Kindly provide them some time.

    • #194865
      Nathan Wolhendler
      Participant

      thank you!

    • #194890

      Hello @Nathan Wolhendler
      You need to add the below code in the functions.php file of your current active theme and use the below short code for the vendor list page to show vendors of different categories on different page –

      
      [mvx_vendorslist orderby=”category” order=”ASC” category="hoodies"]
      
      
      Copy
      
      /**** Add category attribute on vendor list shortcode *****/
      add_filter('mvx_vendor_list_get_mvx_vendors_args', 'mvx_vendor_list_shortcode_category_attribute' , 10 , 4 );
      function mvx_vendor_list_shortcode_category_attribute( $query, $order_by, $qst, $atts ){
         if( empty( $atts ) ) return $query;
         $block_vendors = wp_list_pluck(mvx_get_all_blocked_vendors(), 'id');
         $include_vendors = array();
         $pro_args = array(
            'posts_per_page' => -1,
            'post_type' => 'product',
            'tax_query' => array(
               array(
                  'taxonomy' => 'product_cat',
                  'terms' => array_map('sanitize_title', explode(',',$atts['category'])),
                  'field' => 'slug',
                  'operator' => 'IN'
                  )
               )
            );
         $products = get_posts($pro_args);
         $product_ids = wp_list_pluck($products, 'ID');
         foreach ($product_ids as $product_id) {
            $vendor = get_mvx_product_vendors($product_id);
            if ($vendor && !in_array($vendor->id, $block_vendors)) {
               $include_vendors[] = $vendor->id;
            }
         }
         $query['include'] = $include_vendors;
         return $query;
      }
      
      
      Copy

      Note – modify the short accordingly for different categories.

    • #194898
      Nathan Wolhendler
      Participant

      thank you so much for this! I see this works for the custom view by category can this be used for custom fields as well or just the category field?

    • #194923

      @Nathan Wolhendler The code and short code that we have shared is to show the vendor list as per category. Now if you want to do the same for custom fields then you will have to modify the code and short code accordingly .

    • #194935
      Nathan Wolhendler
      Participant

      I added the code to my site as instructed but it is not filtering, it is still showing all the vendors on the site.
      Here is a link: https://buizmo.com/test/

    • #194950

      @Nathan Wolhendler We have added the code in the functions.php file of the current active theme and on the sort code added category as pant and on the vendor list only the vendor having product of the category pant is displayed on the page and if we change the category then the vendor will be displayed accordingly on the vendor list page.
      Kindly check the video :https://fluvid.com/videos/detail/6Mp2Kuw3nrs9kjy1L

    • #195074
      Nathan Wolhendler
      Participant

      I see now that if the category does not have any vendors then it shows everything that is why I thought it was not working.
      Is it possible to show blank instead of all when there are no vendors for that category?
      Also how can I get the vendors to display without showing top products?

    • #195082

      @Nathan Wolhendler The code we have shared with you using that if you put a category on the shortcode that no vendor has a product of that category then on the vendor list page a message “No vendor found!” will be shown. Kindly check the video – https://watch.screencastify.com/v/PdUVvBzfIsSUBaPsi0NA.
      You can add the below code in the functions.php file of your current active theme to remove the top products section –

      
      
      
      add_action( 'init', 'remove' );
       function remove() {  
        remove_action( 'mvx_vendor_lists_vendor_top_products', 'mvx_vendor_lists_vendor_top_products' );
      }
      
      Copy
    • #195096
      Nathan Wolhendler
      Participant

      I don’t have access to the video. Also, Is there a way to display the store description on there?

    • #195097
      Nathan Wolhendler
      Participant

      And one more point, can you help me modify the code to add my custom taxonomy there (I am not familiar with coding php). The custom taxonomy that I want to filter by in addition to the category is called ‘location’. What code would I add into the snippet you gave me to add this filter?

    • #195133

      Hi, our replies are inline :

      – I don’t have access to the video. Also, Is there a way to display the store description on there?

      >> Make sure that you have passed category name in this shortcode :

      [mvx_vendorslist orderby=”category” order=”ASC” category=”hoodies”]

      Regarding the store description, can you share a scrrenshot of the changes you are looking for so we can assist you.

      – And one more point, can you help me modify the code to add my custom taxonomy there (I am not familiar with coding php). The custom taxonomy that I want to filter by in addition to the category is called ‘location’. What code would I add into the snippet you gave me to add this filter?

      >> We’re happy to try help with these modifications, but only if customization requires few lines (10-15) of new code. However, if your requirement requires more than that kind of effort, we recommend you to contact a developer.
      You may also hire our experts for this : https://multivendorx.com/custom-development/

    • #195146
      Nathan Wolhendler
      Participant

      I have attached the vendor as it looks. now and how I would want it to look.
      For the code you already gave me the code to filter by category (above in the thread) If you can just modify it to add the custom taxonomy called location that would be really helpful! thanks

    • #195190

      @Nathan Wolhendler, as we are not able to enlarge the video, hence please share the site link so we can check the flow and understand the requirement.

    • #195211
      Nathan Wolhendler
      Participant
    • #195230

      @Nathan Wolhendler Kindly refer to our code for map and how we are detecting the current location and then showing the nearest vendors as per that.
      Now you need to incorporate that code with the code we have shared earlier with you to achieve your required flow.
      However, we provide custom code for modifications that need a few lines of code (12-15 lines). But the modification you are looking for needs a huge amount of code and providing that is quite difficult for us.
      So I would request you to contact your developer for this or You may also hire our experts for this : https://multivendorx.com/custom-development/

    • #195273
      Nathan Wolhendler
      Participant

      Thanks, I think you misunderstood my question. I have a custom taxonomy called ‘Location’. I want to filter by that in addition to the category in this code:

      [mvx_vendorslist orderby=”category” order=”ASC” category=”hoodies”]

      /**** Add category attribute on vendor list shortcode *****/
      add_filter(‘mvx_vendor_list_get_mvx_vendors_args’, ‘mvx_vendor_list_shortcode_category_attribute’ , 10 , 4 );
      function mvx_vendor_list_shortcode_category_attribute( $query, $order_by, $qst, $atts ){
      if( empty( $atts ) ) return $query;
      $block_vendors = wp_list_pluck(mvx_get_all_blocked_vendors(), ‘id’);
      $include_vendors = array();
      $pro_args = array(
      ‘posts_per_page’ => -1,
      ‘post_type’ => ‘product’,
      ‘tax_query’ => array(
      array(
      ‘taxonomy’ => ‘product_cat’,
      ‘terms’ => array_map(‘sanitize_title’, explode(‘,’,$atts[‘category’])),
      ‘field’ => ‘slug’,
      ‘operator’ => ‘IN’
      )
      )
      );
      $products = get_posts($pro_args);
      $product_ids = wp_list_pluck($products, ‘ID’);
      foreach ($product_ids as $product_id) {
      $vendor = get_mvx_product_vendors($product_id);
      if ($vendor && !in_array($vendor->id, $block_vendors)) {
      $include_vendors[] = $vendor->id;
      }
      }
      $query[‘include’] = $include_vendors;
      return $query;
      }

      Can you help?

    • #195338

      Our team is looking in to this. We will keep you posted.

    • #197485

      We somehow missed this thread. Kindly let us know if your issue/query is resolved now or not.

    • #197496
      Nathan Wolhendler
      Participant

      I ended up using custom code, you can close the thread

Viewing 34 reply threads

The topic ‘Way to display and filter by vendor instead of product’ is closed to new replies.