Displaying mulyipicks as “related to” help

This topic is: not resolved

This topic contains 4 replies, has 2 voices, and was last updated by  chris.pilko 1 year, 9 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #166317

    codebloo
    Participant
    Post count: 11

    I was hoping someone could paste a snippet of code for me that would fit in (and with) the Monday by Noon tutorial "Team member" page template pulling in the results of a multipick column.

    In my site the team page = product catalog and the team member page = single catalog item

    The pod has a multipick (relating to itself) so I can display matching items/accessories (eg. Goes great with…) but I just don’t know enough to pull in all the multipicks selected for that item and display the name and thumbnail.

    Thank you very much for your help!

    #166318

    chris.pilko
    Member

    Try this code.

    In the "set our variables" area, add this line. This is assuming your multipick field is named related_members.

    Then add this in your "loop", just after the ‘<?php echo $member_bio; ?>’ line:

    Disclosure: I cobbled this together from a few sources. No guarantees there isn’t a fat-finger or two in here.

    #166319

    codebloo
    Participant
    Post count: 11

    Hi! Thank you very much for this. I am grateful for the help! I can read php but I’m not 100% confident about most of the syntax, especially when it comes to looping.

    In this code I did have to add an extra ) in two places –
    "&& 0 < count($member_related)" and " if (!empty($item['photo'])" both needed a second one at the end to make the errors go away.

    The good news is that the page doesn’t break. The bad news is that nothing is being spit out yet. I perhaps have not updated the variables correctly but I will keep testing. Thank you again!!

    #166320

    codebloo
    Participant
    Post count: 11

    So far no luck :S

    BOO!!!!

    This is what I’m using.

    It returns nothing at all. It doesn’t error out, it just blank. Thoughts?

    #166321

    chris.pilko
    Member

    I don’t have a "related items" pick on any of my sites, but I did try this with an image field. There may be an extra array level in there that I didn’t catch, so $item['photo'] may be empty. Add this line after the foreach line:

    You’ll get output that looks like this:

    To reference the image in this image column I had to use $item[0]['id']. If you need help interpreting the result, post your output to a pastebin and post the link here.

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.

Wordpress Cloud Hosting