Skip Navigation

[Resolved] in a many to many relationship how do I add a new farmers market

This support ticket is created 5 years, 7 months ago. 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
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 5 replies, has 2 voices.

Last updated by mindyB 5 years, 7 months ago.

Assisted by: Beda.

Author
Posts
#1262725

Tell us what you are trying to do?
1) add a new farmers market in the relationship. Currently I can edit, and delete how can I add? Please refer to this:

Is there any documentation that you are following?
This helped with edit and deleting, but not adding: Solution: You need a view to display related posts of many to many post relationship and then you should add the delete link for to disconnect the connections. You can find the proposed solution, in this case with the following reply: https://toolset.com/forums/topic/form-submission/#post-1251151

2) in the add the vendor . (new listing ) . how do I add new farmers market to the new vendor listing with the same functionality as with 1) above

thanks, Mindy

#1262995

1. To create new posts you'd use a Toolset Post Form to create new posts.
2. Only if the post created is a Post in a One to Many relationships, and the post created is one of the "many", then the same Toolset Post Form also will allow connecting the Post to any parent. This is the exact same when using Toolset Forms to edit such posts.
3. If you have Many To Many Relationships you cannot connect a post when you create the post. Hence, you'll need two to 4 forms:
- a Post Form to add the Post
- A Relationship Form to connect Posts
- a Post Form to edit posts if required
- A Relationship Form to edit Relationships if required

So in your case, you'd have to create a relationship form.
https://toolset.com/documentation/post-relationships/how-to-build-front-end-forms-for-connecting-posts/
https://toolset.com/documentation/post-relationships/how-to-build-front-end-forms-for-connecting-posts/#creating-forms-relationship-forms

Then, you'd insert that Form like shown here:
https://toolset.com/documentation/post-relationships/how-to-build-front-end-forms-for-connecting-posts/creating-new-connections-between-related-posts/

If you'd want to later edit those, you can use https://toolset.com/documentation/post-relationships/how-to-build-front-end-forms-for-connecting-posts/editing-existing-connections-between-related-posts/, or, as Minesh helped you with already, the delete mechanisms.

Please let me know if you'd need further help 🙂

#1263131
Screenshot 2019-06-08 08.49.02.png
Screenshot 2019-06-08 08.48.06.png

This is what I'm working on now.

I have a relationship form
I created a view and then added the view into an Elementor Template
Now the loop is showing the posted listing, the vendor twice. How do I get one only.
See images above (twice output, with Your Pastry Pal as correct vendor), and the code within the view loop.
Thanks!

#1264967

1. Templates are applied to one item a time. They are used to style the posts. This can be either when you visit a single post or a single post in a loop of posts.
2. Forms are always applying to only one post a time. This is an HTML restriction. It cannot be changed, but you can put many forms, addressing many posts, in a loop
3. The Views, those are loops. They are used to produce a list of many things, not only one output. Just like an archive of WordPress, one could say, where you will always see all posts of a type, for example.

In Views, you could limit the output to one, but we use to recommend in this case not using a View because if you output just one item in a View you could (and should) use a Content Template for example.

The Views are always set to query either posts, users or terms, and the "idea" is that there will be usually more than one item output, as you create "lists" with Views. If you want to output only one item, you can use a Content Template, which will be less resource extensive and easier to create for a single item.
Remember that later you can call content Templates wherever you want, also in Elementor Templates.

Now, I understand you want a Form, to add new Posts, and relate them to a Parent.
Then you don't need to insert the Form in a View. You could insert the Form anywhere, in a Page, or a Post and use it directly.

Maybe you want to have the Parent Post Select Field automatically populated, then, for example, you could use this approach described here https://toolset.com/documentation/post-relationships/selecting-parent-posts-using-forms-create-child-items/#creating-forms-when-a-parent-post-is-preselected

For relationship forms as you have them in the code, you would be connecting posts in an M2M (many to many) relationships.
However, you'll still connect only one post to another, a time
Hence, this Form as well does not necessarily need to be in a View, it could be in the single post.
Only if you'd want to connect many posts, on the same page, using many forms, then you'd use a View.

The rule of thumb would be to create a view only if you want to work on many posts a time and otherwise use the form in single posts.
In a view, you will always have more than one output (unless of course, you limit the view to one, or have only one item in the database to output.)

Please let me know if this helps to achieve the goal.

#1265369
Screenshot 2019-06-11 09.19.20.png
Screenshot 2019-06-11 09.18.43.png
Screenshot 2019-06-11 09.18.37.png

1) I followed the instructions on using the Toolset Forms button, but it only asked for a url and didn't give a "forms child form link" option. It only asked for a url. Not sure why or what I did wrong. Please advise.

2) So I added in the the "Edit Form Attendance Form" directly into the contemplate template for the specific vendor. Why are the vendors not listed alphabetically in the drop down menu?

Thanks, MIndy

#1265805

My issue is resolved now. Thank you!