Support

Account

Home Forums ACF PRO Complex "linking"

Solved

Complex "linking"

  • Hello!

    I’ve several days with this problem and can’t find a solution yet.

    My customer, a company that has many hospitals, has medical analysis in several of them, but they differ depending of the hospital. Hospital A has Analysis A, B, C; Hospital B has Analysis B, D, E. I solved this part using ACF Pro with repeaters, and using Hospitals as custom post types and you select them with a relationship field.

    Here comes the problem.

    There are promos in certain hospitals within certain analysis. But I don’t know how to create them and link them. I could create them by cpt, but how do I get the promo for analysis 1 in hospital X? They’re specific to that combination. I’ve created a diagram with red question marks that show where I am stuck that may help to explain in a better way what I need to achieve ().

    Any help would be highly appreciated!

    Thx in advance!

  • Rather than a repeater field I probably would probably have created a custom hierarchical taxonomy for medical analysis categories. Promos would then be another CPT that uses the same taxonomy and has a relationship field with the hospital CPT.

  • Thx John, I will look that option!!

  • I’ve done last night something very similar to this, a custom hierarchical taxonomy for med. anal. cat.; then created promos as a cpt, using same taxonomy, and a relationship with a hospital ctp; only thing different is that there, in promo, I linked through another relationship to a lab test cpt (every promo has one lab test related; and a lab has many promos, depending on the hospital). But I’m affraid of the performance, because I will use a lot of queries 🙁

  • Sometimes, when working with WP, extra queries are inevitable. Generally, when using ACF relationship fields I set them to only return the post IDs and then I get what I need using WP and/or ACF calls so that the post query is not done by ACF. And I almost always install WP Super Cache when the site goes live. WP has it’s limitations, but when you need to create complex relationships CPTs and custom taxonomies are the only real way to do it. ACF repeater fields are great, but they also have their limitations, like for instance, they are not really very good when you need to create some type of relationship based on what’s in them. The queries you’d need to run to do this would, in the end, create more of a performance issue than what you’ll see by doing it the way you’re not doing it.

  • Thx for the explanation, John!

Viewing 7 posts - 1 through 7 (of 7 total)

The topic ‘Complex "linking"’ is closed to new replies.