Skip Navigation

[Resolved] m-to-m relationship setting

This support ticket is created 6 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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 5 replies, has 2 voices.

Last updated by Luo Yang 6 years, 7 months ago.

Assisted by: Luo Yang.

Author
Posts
#637525

Dear Sir/Madam,

I have many merchants who have many coupons, advertisers also have many coupons, sometimes the same coupons will be shared with other merchants or advertisers use. How can I set the relationship between these merchant, advertiser and coupon custom post?

Relationship case 1
merchant-coupon
advertiser-coupon

Relationship case 2
coupon-merchant
coupon-advertiser

Relationship case 3
merchant-coupon
coupon-advertiser

Which case is setting most appropriate?

Best regards,

Kelvin.

#638129

Dear Kelvin,

For the question:

many merchants who have many coupons

It needs to setup many-to-many relationship between post type "merchants" and "coupons"


advertisers also have many coupons

If one "coupon" post can connect to multiple "advertiser" posts, same as above:
setup many-to-many relationship between post type "advertiser" and "coupons"

More help:
Creating and Displaying Many-to-Many Post Relationships
https://toolset.com/documentation/user-guides/many-to-many-post-relationship/

#638919

Dear Luo Yang,

Thanks for your reply. I read the Creating and Displaying Many-to-Many Post Relationships before ask.

Is there any difference between merchant-coupon and coupon-merchant?

Best regards,

Kelvin.

#640962

It depends on what you are going to achieve, for example, if you are going to:
One "merchant" post can connect to multiple "coupon" posts,
One "coupon" post can connect to multiple "merchant" posts,

Same as above, it needs many-to-many relationship

If you are going to:
One "merchant" post can connect to multiple "coupon" posts,
One "coupon" post can connect to only one "merchant" post

it needs one parent/child relationship, setup "merchant" as parent post type of "coupon"

Hope it is clear

#649479

Dear Luo Yang,

Yes, I got your answer. My question is the setting to the many-to-many relationship, is there a difference if I choose merchant on the left or right-hand side?

#651001

No, there isn't difference on the left or right-hand side.