Custom Content Type Manager
Correlate custom field (4 posts)

  1. premagraphic
    Posted 4 years ago #

    is it possibile to correlate with custom-content-type-manager two custom field such as Text fields con Output Filter settled on "array"?

    For example:

    - The first field is an array named "price", with value: "price 1", "price 2", "price 3".

    - The second field is an array named "price note" with value: "price note 1", "price note 2", "price note 3"

    I would like to correlate these results between them:
    - "Price 1" associated with "known to the price of 1"
    - "Price 2" associated with "known to the price of 2"
    - "Price 2" associated with "known to the price of 2"



  2. fireproofsocks
    Plugin Contributor

    Posted 4 years ago #

    There are probably a lot of ways to do that: it's all a matter of how you structure your data. In this situation I'd probably just add the "associated" data into an array in my template file, e.g.:

    $associated_data = array(
       'price_1' => 'Something related to price_1',
       'price_2' => 'Something related to price_2',
    // And then look up the price:
    $price = get_custom_field('price');
    // Then lookup the associated data:
    if (isset($associated_data[$price])) {
       print $associated_data[$price];
    else {
       print 'No associated price data';

    See how that works? We use the $price to look up a key in the $associated_data hash.

    That's probably the easiest option. Alternatively, you could set up a dedicated post-type for the associated data and use a relation field to select the price you want.

  3. premagraphic
    Posted 3 years ago #

    tankyou for your reply,
    now study this and post the result.

  4. fireproofsocks
    Plugin Contributor

    Posted 3 years ago #

    Let me know how it goes.

    Maybe you can check the box on your dropdown definition to use separate values/labels...

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic