Support » Plugin: Pods - Custom Content Types and Fields » How to dig three levels deep with find()

  • Resolved cannect

    (@cannect)


    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/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Scott Kingsley Clark

    (@sc0ttkclark)

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

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

    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.

    Plugin Author Scott Kingsley Clark

    (@sc0ttkclark)

    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.

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

    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to dig three levels deep with find()’ is closed to new replies.