Skip Navigation

[Resolved] Relationships

This support ticket is created 5 years, 4 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 – 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)

This topic contains 7 replies, has 2 voices.

Last updated by Shane 5 years, 4 months ago.

Assisted by: Shane.

Author
Posts
#1295169

Hi,
I have set up a one-to-many relationship between two posts type (in your examples Airports and Flights, not Toolset types) and it works fine. But in order to make it work I had to enter a parent (airport) value in Flights posts manually, as explained in your tutorial.
Entering parent/link values manually for me is an issue because I load hundreds of posts in Flights via XML file. In the load process I also load the Airport_ID that could be used to link the two post types, but as far as I understand Toolset relationships are stored in a different relationship post type that needs to be loaded separately. Is there any way to set relationship=Airport_ID field directly in the view ? or should I load via XML also the relationship post type ? how ?
thanks regards

#1295291

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Nicola,

Thank you for getting in touch.

I know that for the relationships you can set them in a CSV file and then import them. So what you can try doing is to convert your xml file to a csv and try the instructions below.
https://toolset.com/documentation/user-guides/how-to-import-content-into-wordpress-using-csv/how-to-import-data-from-a-csv-file-using-the-wp-all-import-toolset-types-add-on-plugin/post-relationships/

Also it may even work with the xml file however i'm not sure if the all imports plugin can handle XML files.

Thanks,
Shane

#1296031

Hi Shane,
thanks for your indications, now I understand how it works. Basically you are confirming that there isn't other way than to load the relationship. What really surprises me is that in the documentation above is shown that Toolset works loading descriptions instead of IDs ! in the last picture, what if you had 2,3,4 .... Sandy Hought ? which one would be loaded ? or one could work with IDs too ?
thanks
Regards
Nicola

#1296437

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Nicola,

You can use the post id's as well as it states in the documentation "Instead of the post title, you can also use the post slug or id"

what if you had 2,3,4 .... Sandy Hought ? which one would be loaded

Not sure what you meant by the above.

Thanks,
Shane

#1301639

Hi Shane,
I've been thinking about this and it seems quite weird to me that to maintain a relationship I need to buy a 100$ plugin and install an add-on that is still labelled Beta! All this just to duplicate an information that I already have in the "many" post type. Actually in the documentation is said "Instead of the post title, you can also use the post slug or id" but I cannot figure out how: when it comes to selecting posts, one can just select the custom post types to be linked, but not the fields. Also, when I am into one child post, I can maintain the relationship manually entering the parent value, that is taken from the parent descriptions list, no way to use another field. I'll give you my situation
Parent post type = Shops
[ShopID]
Shop name
Shop description
Shop latitude
Shop longitude
:
-----------------
Child post type = Discounted deals
[DealID]
Deal title
Deal description
ShopID
:
In the deals post type I already have the ShopID (loaded via XML) but when I define a relationship in Toolset I'd need to select the Shop name in the relationship while I could use the ShopID that is already there. This method could be acceptable for loading info into a many-to-many, but for a one-to-many is redundant. Am I wrong or am I missing or misunderstood anything ? is there a way to use the ShopID instead ? thanks regards

#1301683

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

HI Nicola,

Let me see if I can clarify for you. So in our demo here https://toolset.com/documentation/user-guides/how-to-import-content-into-wordpress-using-csv/how-to-import-data-from-a-csv-file-using-the-wp-all-import-toolset-types-add-on-plugin/post-relationships/#steps-to-be-done

You can see the column Speaker in the Presentation table. Speaker would be the Slug of the parent CPT and then under each presentation you can add the ID of the parent instead of the post title, this is how you would use the ID instead of the post title.

So in your case where the Shop is the parent and Discount deals is the child, you will have in your Discount Deals table a column for Shop where you will add the ID of the shop. So It must be the Shops post type slug being the name of the column.

If you can send me a sample screenshot of your data I can have a look to see if anything is wrong.

Thanks,
Shane

#1302697
fields.png

Hi Shane,
I am not sure if the attached screenshot would help you, hope so.
As far as I understand you are suggesting me to relate the slugs instead of the IDs. To me it would be ok but also in that case I'd need to load the Store slug value in the Offers table. What I need is NOT to load a new field if I can use an already existing field! This is what I am asking you for: how to relate the IDs in the screenshot without being forced to LOAD the Store name in the relationship ? Loading a one-to-many relationship it makes no sense also because I could simply create a new Store_Name field in the Offer table and load the store name into that (flat table), no need for a relationship !
Thanks
Regards

#1302969

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Nicola,

You say I was referring to the slug but I actually wasn't, where the slug is you should put the ID of the post in the file.

Better yet could you send me a simple screenshot of the export file to see what you have done so far?

Also the WP All imports plugin allows you to map the fields to already pre-existing fields so you shouldn't need to create new custom fields.

These Post Fields, were they created in Types?

Please let me know.
Thanks,
Shane