WordPress.org

Ready to get started?Download WordPress

Forums

Pods - Custom Content Types and Fields
[resolved] How to dig three levels deep with find() (5 posts)

  1. cannect
    Member
    Posted 1 year ago #

    Hi all,

    I have the following Pods setup:

    • Customer
    • Order
    • Region

    Those are linked as follows:

    • Customer.region -> Region.id
    • Order.customer -> Customer.id

    I have a bulk action where I can select multiple regions and then send the id's of them to a specific custom page I code myself.

    Thus I am having those region.id id's. But I want the following:

    • Select the customers who are in the Region id's
    • Select all customers who have currently orders
    • Select the adresses of those customers

    How to perform such a complex task? I read in the docs at the WHERE parameter the following:

    SQL WHERE to use, like "t.my_field = 'test'" - This field also supports tableless traversal like "my_relationship_field.id = 3" with unlimited depth

    But how to accomplish this?

    Thanks,

    http://wordpress.org/extend/plugins/pods/

  2. Scott Kingsley Clark
    Member
    Plugin Author

    Posted 1 year ago #

    Do you have bidirectional relationship fields setup from Customer to Order?

    Is the address information on the Customer pod or another pod?

  3. cannect
    Member
    Posted 1 year ago #

    Hi Scott,

    Thank you, no I have not setup bidirectional relationship between Customer and Order. Is that unnecessary to for a deep traversal with find()?

    Also, the address information is indeed on the customer Pod.

  4. Scott Kingsley Clark
    Member
    Plugin Author

    Posted 1 year ago #

    It sounds like you're on the scope of the Customer pod, and to only pull customers who have an order, you'd have to have a bidirectional field to use.

    We're working on allowing traversal on fields related to the pod itself, but that's not yet ready.

  5. cannect
    Member
    Posted 1 year ago #

    Thank you, I do twice a fetch on different pods and I am ready.

    Thanks!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic