- This topic has 3 replies, 2 voices, and was last updated 7 years, 3 months ago by
Steve.
-
AuthorPosts
-
-
November 3, 2014 at 10:37 pm #2638
catacalyMemberI had two separate non-hierarchical taxonomies for Manufacturers and Models but decided to make them one single instead of forging a relationship between them as separate taxonomies altogether…
So now I have them in one, make_model taxonomy, and eventually intend to get rid of their default UI, once I have a custom working alternative; because for one thing I only want them to be 1 level deep, that is, excluding the top level — so that top level would be Manufacturers, and the first sub-level would be Models per, and go no deeper. I don’t know how to set a maximum.
First what I need to do is create a meta box in my CPT edit screen, with a select field for Manufacturer, and then a Model field that shows conditionally if any manufacturer is selected, its children, allowing for a selection to be made finally of the Model.
Another thing is that I need a default null value for both of these fields in question. The Model is to be a required field, and for one to be selected, a Manufacturer must be selected, so just the first one cannot be selected by default; default must be no selected value, and upon changing the value of the Manufacturer, the value of the Model should reset to null as well.
Here’s my manufacturer field:
piklist('field', array( 'type' => 'select' ,'scope' => 'taxonomy' ,'field' => 'manufacturer' ,'label' => 'Manufacturer' ,'choices' => piklist( get_terms('make_model', array( 'hide_empty' => false ,'parent' => 0 )) ,array( 'term_id' ,'name' ) ) ));Model I figured would somehow go something like this:
piklist('field', array( 'type' => 'select' ,'scope' => 'taxonomy' ,'field' => 'model' ,'label' => 'Model' ,'choices' => piklist( get_terms('make_model', array( 'hide_empty' => false //,'child_of' => )) ,array( 'term_id' ,'name' ) ) ));utilizing the conditions parameters somehow like here https://piklist.com/user-guide/docs/fields/field-parameters/conditions/ except I don’t quite see how I can tie it all together.
Ideas?
Thanks.
-
November 3, 2014 at 10:47 pm #2639
catacalyMemberIs there a way to pass the child terms to update the reliant model field with choices? instead of just a value?
-
November 3, 2014 at 11:18 pm #2640
catacalyMemberThe master field has got to switch what it updates the conditional field with depending on its own value… which has to be a variable self referenced?
-
November 4, 2014 at 11:59 am #2647
-
-
AuthorPosts
- The topic ‘Manufacturer/Model terms relationship/selection’ is closed to new replies.