Hi there,
I have a Many to Many relationship between Businesses and Services and have the following attached fields: Price and Duration
Services are for instance: Massage / Manicure...
I want to be able to create a Massage for 60 minutes for $120 and a Massage for 90 minutes for $200
I'm able to create a first association (60mn / $120) but after it's created and I want to create the second one for 90 minutes, it's not in the list of services anymore.
I looked at the settings of the relationship: hidden link but can't see where it decides that it has to be a unique selection.
Thanks for letting me know what I'm missing here.
Hello,
I assume you are going to multiple relationships between the same "Businesses" post and "Services" post on the same many-to-many relation ship "Businesses and Services".
If it is, it is not possible, one post can connect other post once on the same relationship.
You will consider other workaround, for example:
1) Create another new post type: "child-cpts", setup those custom fields "Price", "Duration" ...
2) Setup two one-to-many relationships between below post types:
- "Businesses" and "child-cpts"
- "Services" and "child-cpts"
Then you will be able to connect the same "Businesses" post and "Services" post by different "child-cpts" posts
Ok, that's really too bad it isn't possible. Your solution works technically speaking but it looks like it wouldn't really work as a convenient way to enter lots of services and to offer that possibility in the front end for businesses to easily add new services. I want the user to be able to easily add new services.
So does it mean that I would be stuck with using a repeatable group in Businesses instead of a many to many relationship with three fields: a dropdown list for the services + duration + price?
I'll have thousands of services to add so I wanted to stay away from that solution for performances. Also I want services to be a filter on the main search page, do you think that would work and wouldn't get too slow?
Unfortunately, it is a limitation of Many-to-many relationship.
In your case, it needs to setup the post type relationship as I mentioned above:
https://toolset.com/forums/topic/many-to-many-relationship-with-fields-attached-question/#post-1930671
Anyway, you can add a feature request for it:
https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/
Our developers will evaluate it
I did what you suggested but when I'm on the business and click to add a new "biz-service" (the equivalent of your child-cpts), it doesn't give me the option to choose a service, only the fields from the biz-service table: hidden link
Even though it's selected hidden link
So I don't really understand how I can make it work...
Thanks,
You just need to edit the single "biz-service" post, there you can select it's parent "Businesses" post and "Services" post
Ok so you're right, that's a workaround but absolutely impossible to do in real life with hundreds of business to choose from and more services to enter...
That is how Toolset Many-to-many relationship works, I don't think there is other better workaround for now.
Anyway, you can add a feature request for it:
https://toolset.com/home/contact-us/suggest-a-new-feature-for-toolset/
Our developers will evaluate it.
My issue is resolved now. Thank you!