Home Forums WC Vendors Pro Support Custom Taxonomy Integration

NOTICE: We've Moved to a Ticket System for Support

As of August 31, 2017 (12am EST) our support forums will be retired (read-only), and we will be moving to a support ticket system.  This will allow us to better organize and answer support requests, and provide a more personalized experience as we assist our customers.

For the time being, we will leave our forums open for reading and learning while we work on creating a more robust Knowledge Base for everyone to use.

If you are a WC Vendors Pro customer please open a support ticket here. 

If you are a WC Vendors user please open a support ticket on the Wordpress.org forums.

The information on this forum is outdated and in most instances no longer relevant. Please be sure to check our documentation for the most up to date information.

https://docs.wcvendors.com/

Thank you to all of our customers!

 

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #57605
    Derek Smith
    Participant

    Hi there I have semi-successfully integrated custom taxonomies but have 2 issues that need to be addressed.

    I noticed that my custom taxonomy selections are not saving when used in Grouped Products (have yet to try Variables Products).

    Here is the base code I’ve used to integrate (Per other support posts, believe me when I say I searched high and low for better answers prior to posting this.):

    <?php
    /* ADD SUBJECTS TO VENDOR PRODUCT FORM */
    function form_subjects( $object_id ) { 
     WCVendors_Pro_Form_helper::select2( array(
    			'post_id'			=> $object_id,
    			'id'				=> 'wcv_custom_product_subjects[]',
    			'class'				=> 'select2',
    			'label'				=> __('Subjects', 'wcvendors-pro'),
    			'show_option_none'	=> __('Select Subject(s)', 'wcvendors-pro'),
    			'taxonomy'			=>	'subjects', 
    			'taxonomy_args'		=> array( 
    									'hide_empty'	=> 0, 
    								),
    			'custom_attributes'	=> array( 'multiple' => 'multiple' ), 
    			)
    	); 
    }
    function save_subjects( $post_id ){ 
    	$term = $_POST[ 'wcv_custom_product_subjects' ];
    	$terms = implode(',', $term );
    	wp_set_post_terms( $post_id, $term, 'wcv_custom_product_subjects' ); 
    }
    add_action( 'wcv_save_product', 'save_subjects' );
    
    // And the output in product-edit.php
    <!-- Product Subjects -->
    <?php form_subjects( $object_id ); ?>

    Second issue is the dashboard product listings (vendor-dashboard/product/), I can’t seem to locate a template which outputs this page. So I can’t integrate the taxonomies here or customize it at all for that matter.

    I would really like to see this info posted in a KB as I’m sure a fair amount of users have custom taxonomies they need to integrate.

    All in all WCVendors is heads and tails above WooCommerce Product Vendors in so many ways you’ve really done a great service to the WooCommunity! Really looking forward to your WooCommerce Bookings integration (and no, I’m not going to ask when it’ll be ready :-D, I know it’s not a small task).

    Cheers,
    Derek

    #57793
    Derek Smith
    Participant

    Hi there, just wanted put a little reminder here on this.

    #57849
    Anna
    Member

    Derek,
    I can’t answer at the moment as to why this would not be working with the grouped products; likely because those require you to add two products form separate listings.
    As for the template…
    This page- Right- no template.
    It is essentially just a table, with the data gathered for the table.
    I’m not quite sure why you would want to add your taxonomies to this page.. but I can show you where the code is to output info on that page. However, as I am sure you know, unless you can find a way to use one of the filters to add your information, anything added will be swiped during an update and you would have to re-add the info.
    The data is available in two areas that I can find; one being the product-controller.php (wp content/plugins/wcvendors-pro/public/class-wcvendors-pro-product-controller.php) starting at approx line 1585
    And then the header for the page: (wp-content/plugins/wcvendors-pro/public/partials/product/wcvendors-pro-table-actions.php)

    #58728
    Derek Smith
    Participant

    Hi Anna,

    Thanks for the reply, perhaps Ben or Jamie can dig into the custom taxonomies issue further?

    It’s important to me (and I’d assume others) that Grouped Products can fully integrate custom taxonomies as well.

    Tags work just fine for Grouped Products, and the taxonomy fields show up in the edit product page for them, they just aren’t saveable in the WCV frontend (in the WC backend, of course, they do). Making Grouped Products searchable under those custom taxonomies is quite important as you could imagine and is confusing for vendors when they set them but they don’t apply.

    As for the data table, it’d be nice if we could customize that page, so I’ll put in a chit for adding this as a template.

    Thanks again!
    Derek

    #58741
    Anna
    Member

    Derek,
    Ok- thank you. I’ll see if I can get Jamie to take a look and reply or give me a bit more information so we can see if this is something that could be worked with.

    #58775
    Jamie
    Keymaster

    Hello,

    I’m doing some testing today on grouped products and custom taxonomy but I’m not sure why it wouldn’t save. As all products trigger the same code. Your code also doesn’t check for duplicate taxonomy names which defeats the purpose of the taxonomy. You need to check out the tag code in the product controller to see how I’ve stored the tags, you should be able to cut and paste that code and change as necessary. In a future version (possibly 1.4 if I have time) custom taxonomies will automatically be saved with the product controller just like our custom meta fields do.

    cheers,

    Jamie.

    #58941
    Jamie
    Keymaster

    Hello,

    Apologies for the delay in response. I had to build a complete environment to test this. I was also finishing off bookings and 1.4 code this weekend. This code works for grouped and normal products.

    https://gist.github.com/digitalchild/128033d2d41f682acd4387b595d4f607

    Also 1.4 will support auto save for custom taxonomies for anything that is prefixed with _wcv_custom_taxonomy_{your_taxonomy_here} or wcv_custom_taxonomy_{your_taxonomy_here}

    v1.4.0 is out tomorrow, doing my final testing now.

    cheers,

    Jamie.

    #58949
    Derek Smith
    Participant

    Oh my oh my!

    Stellar news Jamie, honestly I would’ve patiently waited a few more weeks if I had known you had your head buried in 1.4 and that WCBookings is in fact going to be supported.. Super looking forward to checking it out! Will be sure to give you a heads up if I find anything.

    I do have a thought on the flow for grouped products. People have found it counter-intuitive to go back through each individual product’s edit page and link it into the grouped product. Now I’m fully aware that that is how WC itself works in the backend, so I’m certainly not throwing any fault your way. That said, it would be much better UX to be able to select the products straight from within the grouped product edit page.

    If I can find the time to pull it together I’ll be sure throw some code your way (Consider it a cherry on top for all your hard work getting 1.4 out the door. :-D). At the very least I’ll definitely be putting a chit in to the WC crew and see what they say.

    Happy Testing!
    Derek

Viewing 8 posts - 1 through 8 (of 8 total)
  • The forum ‘WC Vendors Pro Support’ is closed to new topics and replies.