Support

Account

Home Forums ACF PRO Repeater Fields Comparison

Solving

Repeater Fields Comparison

    • 3mounika

    • September 27, 2019 at 5:02 pm

    Hello,

    I’m getting ready to build a new website that compare internet plans from different providers. Here users will select a different plans from different providers and will see the comparison side by side.

    I will use repeater field.

    Example:

    Provider 1

    Plan A – 1 Mbps – 25 GB Data – $10
    Plan B – 2 Mbps – 50 GB Data – $15
    Plan C – 3 Mbps – 75 GB Data – $20

    Provider 2

    Plan A – 1 Mbps – 25 GB Data – $10
    Plan B – 2 Mbps – 50 GB Data – $15
    Plan C – 3 Mbps – 75 GB Data – $20
    Plan D – 4 Mbps – 95 GB Data – $25

    Provider 3

    Plan A – 1 Mbps – 25 GB Data – $10
    Plan B – 2 Mbps – 50 GB Data – $15
    Plan C – 3 Mbps – 75 GB Data – $20

    Now user will select different plans (max 3 plans) from different providers or same provider, he will redirect to comparison page and will see the chart.

    The question – Is it possible with repeater field group. Because we need to select a particular row of the repeater field group.

    Any suggestions would be greatly appreciated.

    Thanks.

  • This would be extremely difficult as there is nothing in the repeater to identify it unless you create that identification.

    Basically you would need to
    1) Get the post where each repeater resides resides
    2) Loop through the repeater until you find the row you’re looking for
    3) Store the value of the row, possibly in an array, for later comparison

    So when selected there would need to be 2 pieces of information passed to the comparison page, the “Provider” and something unique in the repeater row to identify the “Plan” from that provider so that you could do the querying and getting of the row from the repeater.

    • 3mounika

    • September 28, 2019 at 3:10 pm

    Thanks for the reply.

    It seems very difficult, because i’m not an expert. But I got your point I need to assign an ID to each row (add an unique ID to each row dynamically.). I will try this.

    Is there any other good solution for this, like using flexible content fields or relationship fields over repeater field.

  • I personally would create a hierarchical post type where the top level post was the “Provider” and each “Plan” was a child post. Then you can simply identify the plan and the provider using the plan’s post ID.

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

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.