Home Forums WC Vendors Pro Support How add a custom taxonomy in Products

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 27 posts - 1 through 27 (of 27 total)
  • Author
    Posts
  • #34674
    Lydia
    Participant

    Hello, i need help with add a custom taxonomy in products. How i can get it?

    #34675
    WC Vendors Support
    Participant

    Your question is pretty vague. What are you actually trying to accomplish? More details the better help me provide the best reply! 🙂

    #34698
    Lydia
    Participant

    I’m trying to put a box like categories for products.

    #34699
    WC Vendors Support
    Participant

    It sounds like you want to use attributes — that’s my closest guess! But still, “a box like categories for products” doesnt help much either.

    #34705
    Lydia
    Participant

    I need help to add a box like this.

    I ‘ve been reading, try using advance custom fields , but it not sends data to the backend

    #34729
    Lydia
    Participant

    I try with the code

    <?php WCVendors_Pro_Form_helper::select( apply_filters( ‘wcv_caracteristicas’, array(
    ‘post_id’ => $object_id,
    ‘id’ => ‘wcv_custom_product_caracteristicas’,
    ‘class’ => ‘select2’,
    ‘label’ => __(‘Caracteristicas’, ‘wcvendors-pro’),
    ‘taxonomy’ => ‘caracteristica’
    )
    )
    ); ?>

    But it does not show me any taxonomy,

    I Try with advanced custom field, but don’t send the data to the dashboard

    #34751
    Jamie
    Keymaster

    Hello,

    You’re code is not telling the system to show terms that have nothing set so it won’t actually show any terms in the drop down. Our code currently doesn’t support saving custom taxonomies so you will have to hook into the product save action to add the saving code. I have assumed that you have defined them like categories (hierarchical). Here is the code to update the form and save the data however displaying this custom taxonomy on the product page in the store is beyond the scope of our support as this is to do with your theme and woocommerce.

    https://gist.github.com/digitalchild/395f22fd79c95b5d8491e7a5275de7f7

    cheers,

    Jamie.

    #34752
    Jamie
    Keymaster

    Hello,

    And one other thing, this code will not work until our next pro update as there is a bug in our form builder.

    cheers,

    Jamie.

    #34754
    Lydia
    Participant

    Hello Jamie,

    Thanks you for the awnser.

    Now showing out in plain text, I can use this, however I need to be multi selection.

    #34761
    Jamie
    Keymaster

    Hello,

    I’ve updated the gist to allow multiple selections for the custom taxonomy. If you want it to look like the backend categories selector then that is completely different code and we currently don’t support that in our form helper. That code is only for categories.

    cheers,

    Jamie.

    #34763
    Lydia
    Participant

    Okay Thanks you jamie, and when is the next update ?

    #34764
    WC Vendors Support
    Participant

    Most likely within a few days. We’re just buttoning up some other work that will be released at the same time.

    #34768
    Lydia
    Participant

    And a similar selector using attributes ?

    I need a multi select option

    #34769
    Lydia
    Participant

    The option you provide me only shows me 1 tag in the backend

    #34864
    Jamie
    Keymaster

    Hello,

    Can you explain to me what is wrong with the attributes tab already included that is exactly what you want? I will update the gist to fix the multi select save in a few moments.

    cheers,

    Jamie.

    #34865
    Jamie
    Keymaster

    Hello,

    Gist updated to work with multiple select and save.

    cheers,

    Jamie.

    #34904
    Lydia
    Participant

    Hello jamie,

    I now can’t see the values of caracteristicas in the dashboard.

    I Wait for the update,

    I will try to use while the product add-ons of woothemes, do you know how get the attribute id in product add-ons?

    I have seen an issue here, on how to add data using update_post_meta ();

    But not find the metadata,

    I to use the get_post_meta (); but i don’t have the id.

    #35171
    Lydia
    Participant

    Hi support,

    I updated the plugin. The first solution that you have given me no longer works. Only shows numbers (only select one option).

    And the last either. Why?

    #35172
    Jamie
    Keymaster

    Hello,

    What exactly is it showing? I need actual data so I can debug. I need screen shots so I can see what the problem is. ‘It just shows number’ gives me nothing to work with.

    cheers,

    Jamie.

    #35191
    Lydia
    Participant

    Hello Jamie,

    Sorry for the headache that should cause.

    I create another select option simple as the first call wcv_custom_product_jornadas

    function form_jornada( $object_id ) { 
     WCVendors_Pro_Form_helper::select( array(
    			'post_id'			=> $object_id,
    			'id'				=> 'wcv_custom_product_jornada',
    			'class'				=> 'select2',
    			'label'				=> __('Tipo de Jornada', 'wcvendors-pro'),
    			'show_option_none'	=> __('Select a Jornada', 'wcvendors-pro'),
    			'taxonomy'			=>	'wcv_custom_product_jornada', 
    			'taxonomy_args'		=> array( 
    									'hide_empty'	=> 0, 
    								),
    			)
    	); 
    }
    function save_jornada( $post_id ){ 
    	$term = $_POST[ 'wcv_custom_product_jornada' ]; 
    	wp_set_post_terms( $post_id, $term, 'wcv_custom_product_jornada' ); 
    }
    add_action( 'wcv_save_product', 'save_jornada' ); 

    and Caracteristicas not shown me anything

    #35215
    Jamie
    Keymaster

    Hello,

    It has to be ::select2 function for it to populate the data. What kind of taxonomy is it you didn’t answer that question I had earlier on. The number that is shows in the backend is the taxonomy ID which is how wordpress stores everything in the backend. If you want it to show you a name in the backend it’ll require a bunch more custom code beyond our support.

    cheers,

    Jamie.

    #35248
    Lydia
    Participant

    thanks jamie,

    But before the update it showed the name.

    And the multi selector, which is published does not show me anything in the backend.

    I just want a simple multi selector.

    I’ll try adding to jornadas, the Select2

    #35293
    Jamie
    Keymaster

    Hello,

    Yes showing the name was actually a bug, which meant if you had the same name for a taxonomy (which is possible) it wouldn’t know which one to store and display which is why it needs to be the id of the taxonomy and not the name.

    I currently have the multiselect working and displaying in the backend without issues using the github code above.

    cheers,

    Jamie.

    #35517
    Lydia
    Participant

    Hi jamie, Thanks.

    How output the multiselect?

    __

    I solved this.

    Shown in the front-end, but not in the backend

    #35998
    Lydia
    Participant

    Hello Jamie, Sorry D:

    But how change the multiselect for list?

    wcv_terms_checklist ?

    #36068
    WC Vendors Support
    Participant

    To code multi select you would have to code it yourself, it’s not part of Pro.

    #54151
    Derek Smith
    Participant

    Hi @ben,
    After a bit of searching I luckily just ran across this post.
    Would you kindly add this as a KB so others can use this info to add custom taxonomies to their forms?
    It’s probably quite useful for many.
    Cheers

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