Skip Navigation

[Resolved] Post not found when connecting posts through relationships

This support ticket is created 5 years, 1 month 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.

Our next available supporter will start replying to tickets in about 0.32 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Author
Posts
#1362631

I am trying to:
Connect National Listing posts to Support Sub-Categories.
I have set up a one-to-many relationship where one National Listing can connect to infinite Support Sub-categories.
(This is a recent correction to the relationship I had previously set up where one Support Sub-category can connect to many National Listings)

However, when I try to connect a National Listing post to a Support Sub-Category, only limited Support Sub-Categories are show. For example, when I go to the latest National Listing and navigate to the "National Listings Support Sub-Categories" area and click "Connect existing Support Sub-category" and search for "mental health", it is unable to find that "mental health" support sub-category.

#1362895

For example, when I go to the latest National Listing and navigate to the "National Listings Support Sub-Categories" area and click "Connect existing Support Sub-category" and search for "mental health", it is unable to find that "mental health" support sub-category.
Okay the National Listings Support Sub-Categories relationship is a one-to-many relationship:

National listings [0 .. 1] << Support Sub-categories [*]

That means each Support Sub-category post can only belong to ONE National Listing post. Any Support Sub-Category that is already linked to a different National Listing post cannot be linked to the latest National Listing post in this one-to-many relationship. That would require a many-to-many relationship, not a one-to-many relationship, right? Many Support Sub-Categories can link to a single National Listing, and many National Listings can link to the same Support SubCategories.

Interestingly, you can see that the Mental Health Support Subcategory post is already linked to MULTIPLE other National Listing posts in the current one-to-many relationship. That's invalid or corrupt data and likely to cause problems for you down the road:
hidden link

So may I ask if you edited an existing relationship to change the relationship type, creating this National Listings Support Sub-Categories relationship? Or was it created some other way, and content was imported?

#1362961

Previously I had a one-to-many relationship set up so one Support Sub-category linked to multiple National listings.

I used Ultimate CSV Importer Pro which uploaded multiple Support Sub-categories to each National listing. However, this method stopped working two days ago. When I asked Ultimate CSV Importer Pro they advised that what I was doing should not be possible and I should set up the relationship the other way - which is why the relationship is one-to-many the opposite direction - one National listing to multiple Support Sub-categories, and that I should check with you (Toolset).

So what you are recommending is that I set up a many-to-many relationship? Which is the best way to do this, in order to retain the existing relationships? Should I amend/edit the first one-to-many Support Sub-category to multiple National Listings, or start afresh many-to-many and then revise all existing data?

#1362983

So what you are recommending is that I set up a many-to-many relationship?
I don't know for sure, because I'm not really familiar with your site data. Let me say it this way: If one National Listing post can be connected to many different Support SubCategory posts, and also one Support SubCategory post can be connected to multiple National Listing posts, then a many-to-many relationship is recommended.

Which is the best way to do this, in order to retain the existing relationships?
If a many-to-many relationship is what you want, then unfortunately there is no good way to retain the existing relationships. They are all invalid because they were defined in one-to-many relationships. These should not be used to define many-to-many relationships. The existing relationships should be removed.

Should I amend/edit the first one-to-many Support Sub-category to multiple National Listings, or start afresh many-to-many and then revise all existing data?
Start afresh with a new many-to-many relationship and revise the existing posts.

#1363291

Thanks Christian.

Do you know how I can export all previous data, including the relationships, so that I can amend and reupload it?
I will be using CSV Importer Pro for the bulk upload.

#1363485

I'm not sure how to amend existing one-to-many relationships to create a many-to-many relationship, it's not recommended and could cause unforeseen problems. I recommend starting that relationship from scratch. For other data, you can export the Types structures with Toolset > Export > Types, and you can export post content with relationship data using WordPress > Export.

#1363741

The WordPress>Export downloads it to a table thousands of rows that I can't make sense of...
Do you know how I can download this so that the each row contains one National Listing post?

#1363797

The WordPress export format is XML, not CSV. If you want a CSV format, you'll have to use some sort of conversion tool. That's not something Toolset is really designed to help with.

#1363937

Hi Christian, I ended up doing this the long way round but I have:

- Downloaded, edited and imported the National listings posts so that related Support Sub-categories are now captured via the new many-to-many relationship
- Deleted the one-to-many National listings/Support sub-categories relationships
- Rebuilt the Relevanssi index.

But now the search function on the site isn't picking up any National listing posts?! For example, when you hit "Go" it usually shows you all of the National listings posts. Now, it shows none, and instead the message when no posts are found.

To counter this I reimported a bulk of National listings - but this hasn't made any difference.

Please help!

#1364043

This is the weirdest thing. If I open a national-listing post and add a space to the post title, then save it, then it is visible as a result.
However it is not mapped to the browse by category dropdowns.

Please, please help. I'm so stuck.

#1364313

I'm not sure what to do about this or how I can resolve it.
Can you see what the issue is?

#1364953
listing.png

Hi Christian, I've parked the dropdown issue for the time being and removed them.

A more pressing issue has come up 🙁

I think there might be a problem with the content template. On display, very often in the thank-you field, it also shows the post relationship and relationship slug contents. I have no idea how this has happened, it's so odd.

What do you think might be causing this? I can report this as a new issue if you would prefer?

Many thanks,
Cat

New threads created by Christian Cox and linked to this one are listed below:

https://toolset.com/forums/topic/relationship-slug-showing-in-text/

#1365011

I tested this with the Rare diseases entry. I went back into the National-listing associated with that.
In the Thank-you field I added a space behing Rebekahs name and saved the post.
When I refreshed the display it displayed fine, without being trailed by relationship data.

I don't want to have to go into each individually to sort this when there's clearly some issue causing this - either at Toolset or CSV Importer end, but I don't really have an issue as it has a massive impact on the functionality of the site.

#1366485

Based on examination of the database for the other ticket, I'm fairly confident there is a database corruption issue at play here. Let's come back to this ticket when we have ironed out that issue.

#1366647

Hi Christian, the data corruption is now resolved.

However, the dropdown categories is still not working. See this page here - hidden link

Selecting on the dropdown doesn't seem to filter the data at all.

Do you know what might be causing this and how to resolve it?

Thanks,
Cat