Sauter la navigation

[Résolu] Manage terms fields in front end with Cred

Ce fil est résolu. Voici une description du problème et la solution proposée.

Problem:

The issue here is that the user wanted to know if it was possible to create taxonomies and populate their custom fields from the frontend.

Solution:
Unfortunately no it is not possible because you are not able to create terms through the frontend forms as you would with posts.

The term meta will need to be filled out on the backend.

This support ticket is created Il y a 5 années et 7 mois. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

Marqué : 

Ce sujet contient 21 réponses, a 2 voix.

Dernière mise à jour par Pat Il y a 5 années et 7 mois.

Assisté par: Shane.

Auteur
Publications
#1249715

Pat

Hello,

I have created a taxonomy and some custom term fields associated.
I would like to manage these fields in the front end thanks to a Cred, but I did not see any way to do this.

Can you explain how this can be done ?

Regards
Pat

#1249725

Shane
Supporter

Les langues: Anglais (English )

Fuseau horaire: America/Jamaica (GMT-05:00)

Hi Pat,

Thank you for getting in touch.

Unfortunately no it is not possible because you are not able to create terms through the frontend forms as you would with posts.

The term meta will need to be filled out on the backend.

Thanks,
Shane

#1249773

Pat

Hi Shane,
Thanks for the info.
To me, this is a pity not to be able to do this. I was not aware of this and based 2 of my new sites on taxonomies and now, I'm obliged to move to another solution (i mean post relationship ?).

Wouldn't it be possible to find a way to create / update terms thanks to Cred + cred save data?

Regards
Pat

#1251085

Shane
Supporter

Les langues: Anglais (English )

Fuseau horaire: America/Jamaica (GMT-05:00)

Hi Pat,

Yes I would suggest a post relationship.

It is possible to create / update the terms using a Hook but its not efficient. Each time you are using the form to create a new term, you will essentially be creating a new post when creating a term.

Also to update a term you will need to edit a post. This is not efficient .

Thanks,
Shane

#1251165

Pat

Hi Shane,

Thanks for the info.
This was my "fear" I need to restart ans replace taxonomies with post relationship.

Now, before starting, I would like to better understand the way it is working.
Here is my need :

I have WC product and have created a specific postype for localisation.
I have also a Cred that helps to modify a product in the front end.
What I need is to add in this Cred, the ability to chose a specific localisation, and if possible, thanks to a select field.
So, for the moment, I have created the form post relationship (many to many) between product and localisation, but I'm lost on how to insert in a Cred form the ability to chose a localisation when editing a product.

Can you help please
Thanks
Pat

#1251169

Shane
Supporter

Les langues: Anglais (English )

Fuseau horaire: America/Jamaica (GMT-05:00)

Hi Pat,

Since this is a many to many relationship you won't be able to set the post relationship from the edit or create post form.

You will need to create a relationship form. This is because the many to many relationship is structured differently from the one to many relationship.

I'm assuming is the issue is that your products can have many localisations.

Thanks,
Shane

#1251239

Pat

Hi Shane,

Yes products can have different location and 1 location could stand for different products. That's why I have chosen many to many.

Can you explain how I need to proceed in order to get the select location inside the Cred used to modify products
Regards
Pat

#1251255

Shane
Supporter

Les langues: Anglais (English )

Fuseau horaire: America/Jamaica (GMT-05:00)

Hi Pat,

The selection location won't be in the same CRED form that is used to create the location or product.

It will happen after, the form will need to redirect to page or you add the relationship form directly to the post itself.

Have a look at our documentation below for a clearer picture on this.
https://toolset.com/documentation/post-relationships/how-to-build-front-end-forms-for-connecting-posts/creating-new-connections-between-related-posts/

Thanks,
Shane

#1251259

Pat

Hi Shane,

I'm a bit désappointement. I was thinking it should be easier with the new Toolset relationship !

So, if I'm right, the only way to get what I need is what we can call "the old way", which is to create a Views to list the different posts of location and then, insert is a the option of a generic field?

Let me know if you have any other idea.
Regards
Pat

#1251299

Shane
Supporter

Les langues: Anglais (English )

Fuseau horaire: America/Jamaica (GMT-05:00)

Hi Pat,

That is correct. We are improving on this and plans are being put in place to actually replicate the relationship creation on the frontend like how we have it on the backend.

With the location will it just be a name ? I saw that you mentioned custom fields but what is the purpose of having the custom fields. Is the location just being used to Tag the product ?

Please let me know.

Thanks,
Shane

#1251315

Pat

Shane,

The custom fields are necessary in order to add the address of the location. I'm also using another taxonomy for defining the people in charge of the event. Here, I 'm using fields for description and a photo of the person.

If I was not using custom fields, then taxonomy could have been sufficient as we can add additional items in the front end, but here, this is not the case and I need to be able to recover the needed custom fields, even if only one is necessary !

Regards
Pat

#1251333

Shane
Supporter

Les langues: Anglais (English )

Fuseau horaire: America/Jamaica (GMT-05:00)

Hi Pat,

I see the full picture now.

Yes you will definitely need to do this with a post relationship then. I was trying to see if the taxonomies would work but based on what you just explained the post relationship would be the best option.

Thanks,
Shane

#1251341

Pat

OK understood.

So, I just need to define that product is a parent of location (or the other way ?) and create a Views that lists the different location to be inserted inside the option of a generic field. That mean this generic field should be a numerical field and we will save the ID of the location in it. As it is possible that several locations apply to the same product, how do I need to manage this (is it possible to define a generic field having several values like we can do for custom fields ?).

In parallel, I need to prepare the management of the locations (list of the location + a button to modify it and the ability to create a brand new location.

Does that makes sense?

Regards
Pat

#1251345

Shane
Supporter

Les langues: Anglais (English )

Fuseau horaire: America/Jamaica (GMT-05:00)

Hi Pat,

Actually you dont need a view.

Based on this here https://toolset.com/documentation/post-relationships/how-to-build-front-end-forms-for-connecting-posts/creating-new-connections-between-related-posts/#connecting-child-posts-to-a-specific-parent

You can add a link to the relationship form which would have the product already filled in and then all you need to do is to connect that product to the existing location.

I mean you can also list out all the products in the view and then add the said link to the view as well .

Thanks,
Shane

#1251349

Pat

Shane,

Just discover that the relationship management is no more what I was expecting. I have seen the announcement but never used it since then.

What do I need to take into account for my specific case. After having created the form relationship between product and location and the Views to list all locations, what kind of generic field do I need and how to populate it inside the Cred form that modify a product?

Last point concern the way to accept several values for this field. How can I do this?

Regards
Pat