• Resolved tomwelco

    (@tomwelco)


    I'm working with two pods in a bidirectional relationship. I'm testing this on a blank page and using the plugin "Insert PHP Code Snippet"
    If I open the pod that contains a Simple (custom defined list), it produces all the labels of the terms in the Simple (custom defined list) not the values.

    // Get the vendor by ID. WORKS!
    $vendors = pods( 'vendor', 15361 );
    echo $vendors->display('post_title') . '<br>';
    echo $vendors->display('vendor_terms');

    Produces:
    Dam LLC
    N30, VS, MC, and Amex

    When I use the connection from the other pod connected by relationship, it only shows the value of the first item.

    // Get the vendorspecials by ID. NON-WORKING
    $vendorspecials = pods( 'vendor_specials', 31681 );
    echo $vendorspecials->display('post_title') . '<br>';
    echo $vendorspecials->display('special_vendor.vendor_terms');

    Produces:
    Dam LLC
    net_30

    Why do they each show differently? Shouldn't they both show the values not the labels? They should show all items in both?
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Paul Clark

    (@pdclark)

    A database relationship is usually stored as an ID, or in this case value, because labels are not required to be unique.

    The relationship stores as a value because labels could be duplicated; non-unique.

    For more complex use cases, where label versus value matters, a relationship to a formal post type would usually be a better fit.

    Thread Starter tomwelco

    (@tomwelco)

    Thank you Paul. That makes sense.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.