• Resolved listictac

    (@listictac)


    Hi,

    I need to store a list of different properties with quantity for each custom post. For example, list of properties: «aaa», «bbb», «ccc», «ddd». Posts: «foo» and «bar»; connections: «foo — 70% aaa, 20% bbb, 10% ccc», and «bar — 50% bbb, 30% ccc, 20% ddd». I want to be able to select all posts with «bbb» property, but how could I store its quantity?

    If I create three text fields plus three relationship fields, I will not be able to filter by all three of them.

    In a perfect SQL world it would be a join table with one extra column for quantity, but how would that work with Pods?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Jory Hogeveen

    (@keraweb)

    Hello @listictac
    Not sure I fully understand what you want but from your quick layout I would guess you could do something like this:

    5 numeric fields with a range between 1 and 100 (0 = empty)
    <aaa>
    <bbb>
    etc.

    to select the posts based on their values you could to a numeric filter in in your query or if you only want you get posts which have a number at all you could filter if the field is higher than 0 of just use EXIST in your SQL compare.

    Let me know if this helps!

    Cheers, Jory

    Thread Starter listictac

    (@listictac)

    Hello @keraweb

    Thanks for your answer.

    My idea is somewhat close to a recipe catalog, where you can filter dishes by sugar, for example. And product dosages are stored in a separate table, not in taxonomy or a custom field.

    Plugin Author Jory Hogeveen

    (@keraweb)

    Ah now I get your issue.
    Sorry but I believe this will require functionality that Pods does not provide at this moment. You will have to create your own add-on for this.

    Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @listictac
    Talked this over with our support guru Jim.
    There is a way to do such a setup. You would need to create a bridge between Recipes and Ingredients.

    So you create 3 post types: Recipes, Recipe Ingredients and Ingredients
    Recipe ingredients is related to Recipe and Ingredient, it has ‘post title’, no editor, one field: quantity.

    The Recipe CPT has one multiple relationship field to the Recipe Ingredient (bridge) CPT.

    Hope this helps!

    Cheers, Jory

    Thread Starter listictac

    (@listictac)

    Hi @keraweb

    Thank you for your suggestion! But I have already found another plugin with this feature built-in.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Many-to-many relationship with an extra field’ is closed to new replies.