Thank you for sharing the observations. I'll try to comment on them point-by-point.
> Finally, the whole website is extremely slow (I can barely work). Did you change anything in the database? (other than the pages and views you've created). Otherwise, something happened and I don't know what!
- The only changes I made were around the created views and pages and no other website settings were changed.
> I tried exporting XML of Régions and Villes (all related to Lieux), but at each time, the only relationship recognized was the "parent" one, and nothing related to the "child" Lieu.
- Your observation is correct and expected. The relationship import mechanism through custom field works to import parent posts and intermediary posts (in case of many-to-many relationship), but not the child posts.
( ref: https://toolset.com/course-lesson/importing-content-from-csv-with-post-relationships/ )
> So, if I recapitulate
- Exporting in XML with any plugins (so far): _toolset_associations fields are not included
- Exporting in CSV with any plugins (so far): _toolset_assocaitiosn fields are not included
- Exporting in WXR through the regular WP Export tool includes _toolset_association fields, but my website bug
- Importing XML files: _toolset_associations are not included
- Importing CSV files: _toolset_associations fields are not recognized
- Importing WXR files: _toolset_assocations fields are recognized and new ones are imported, but they need to be manually added to the files in the source website
- XMR files from WP tool and XML files from plugins do not have the same look / content
Is there a tool to edit XMR file in bulk?
So I'm back to the same problem, I can't edit associations in bulk (CSV file)
- To better understand these points, it is better to understand how the relationships and their import/export work in general.
Toolset's post relationships are not stored in form of custom field values. They are stored in their dedicated tables, which I'll explain in the next point.
Because, the relationship data is not stored in the custom field values, it is also not included in the export file when you make it through any third-party export plugin.
Relationship data is included in the export file created through the regular WordPress export feature, because Toolset includes a built-in feature to include it.
But since the regular WordPress export WXR feature fails on your website's data, we'll keep the focus on the CSV export/import.
As for the relationship import feature, it looks for the custom field key/column in the specific format ( _toolset_associations_%relationship_slug% ). If some titles are found in a custom field stored in this format, it is recognized as the related post and upon the successful import of this relationship, that custom field record is deleted.
> Oh... and I also tried to edit the database itself with PHPmyadmin, but I could only find numbers and no way to see which CPT is related to which parent / child
- Information about each registered relationship can be seen in the table named '{table-prefix}_toolset_relationships'.
Whenever a post is joined in any relationship for the first time, its entry is included in the "{table-prefix}_toolset_connected_elements" table. Post ID of that post is saved under the "element_id" and every record in the table is given a new unique "id".
The actual post-relationship connections are saved in the "{table-prefix}_toolset_associations" table based on those new "ids" from the "toolset_connected_elements" table.
> But I still have issues
1) The system don't recognize cf__toolset_associations_lieu-et-region on CSV files, but it does in WXR files (I copy-pasted the slug from the WXR and added cf_ as for the 2 other associations types, so I don't understand)
2) Even if it recognize the lieu-et-quartier and lieu-et-ville slug, it imported only 3 of the 3 associations, giving me the error "3 associations couldn't be imported - Link broken associans"
- As a discussed above, for the CSV/custom field import process the expected/recognized key is "_toolset_associations_%relationship_slug%". The format 'cf__toolset_associations_%relationship_slug%' is what is used when an import/export WXR file through WordPress regular import/export feature is used.
The reason for the failed import of the recognized association would most likely be that
a). an existing parent post is already connected to the imported post
b). or previous unsuccessful import process could've incorrectly set the relevant post's relationship entry in "{table-prefix}_toolset_connected_elements" table.
Did you check the details, by clicking 'List broken associations'?
( screenshot: hidden link )
Considering what we've discussed so far, it would be best to get a custom function or shortcode developed that would:
1. Cycle through all the child posts (involved in that target relationship) in the primary language and set the existing related parent post's title in a temporary custom field key, for example '%relationship_slug%'.
Important note: When WPML translated posts are involved relationships are created only between the posts in the primary language. For the translated posts, the relationship information is inherited from the primary posts, automatically.
This way when you'll create an export CSV file through any plugin, it will be included in the exported file, as a custom field column.
2. Next, you can edit the exported CSV file to add any more titles of new connections to add for the parent posts, in that same custom field column.
3. Once the CSV file is ready, import it through any import plugin and now you'll have the new connection post titles in that custom field keys. But they won't be yet recognizable by the Toolset relationship import feature, because the key for the custom field key is not in the format "_toolset_associations_%relationship_slug%".
4. Next step would be to replace all custom field keys '%relationship_slug%' to '_toolset_associations_%relationship_slug%' format. You can either use the direct SQL search and replace operation on the database through phpMyAdmin or use custom PHP code.
5. Once the custom field key has been replaced, the associations should become available for import through the Toolset's relationship import section.
I hope these steps will make sense and let me know if any point is not clear.