ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

related entries / dynamic / display

December 17, 2010 2:20pm

Subscribe [5]
  • #1 / Dec 17, 2010 2:20pm

    Eastwood Design

    605 posts

    bear with me.

    I have 2 weblogs artist and products
    each product is related to an artist entry

    on my page that displays the product in detail I want to also display thumbs and links to all the other products that are related to that artist.

    so on my detail page: http://www.domain.com/indexee.php?/site/fine_art_detail/edge_of_the_woods/

    I have this in my template:

    This displays the product details:

    {exp:weblog:entries orderby="date" sort="asc" limit="1" weblog="Products" dynamic="on" disable="member_data|trackbacks"}
    {product_image}                            
    
    <div id="producttextdetails">
    <h3>{title}</h3>
    <p>{related_entries id="product_artist"}</p>
    
    <p>Artist: <a href="http://www.domain.com/indexee.php?/site/artist_detail/{url_title}">{artist_first_name} {artist_last_name}</a><br />
    {/related_entries}<br />
    Medium: {product_media}<br />
    Dimensions: {product_size}<br />
    {if product_sold == "Sold"}SOLD{/if}{if product_sold == "Available"}Price: {product_price}{if code}<br />
    {code}{/if}<br />
    <!--END PRODUCT--><br />
    {/if}<br />
    {/exp:weblog:entries}


    And then I want this to display thumbs of all entries in the products weblog that are related to the artist that we are viewing above.

    {exp:weblog:entries orderby="date" sort="desc" limit="99" weblog="Products" dynamic="off" category="5" disable="member_data|trackbacks"}
                <!--START PRODUCT-->
               {related_entries id="product_artist"} 
              <a href="http://{title_permalink={my_template_group}/fine_art_detail}" title="{title}">{exp:ed_imageresizer_                image="{product_image}"_              default=""/images/site/image_coming_soon.jpg"_              maxWidth="50"_              maxHeigth="50"_              cropratio="1:1"_              class="borderimg"_              alt="Image description"} </a>
                {/related_entries}
                  <!--END PRODUCT-->
                {/exp:weblog:entries}
  • #2 / Dec 17, 2010 2:28pm

    Eastwood Design

    605 posts

    I tried the reverse related entries to display all the products that are related to the artist but I am getting EVERY product

    {exp:weblog:entries orderby="date" sort="desc" limit="99" weblog="artists" dynamic="off" category="5" disable="member_data|trackbacks"}
                <!--START PRODUCT-->
    {reverse_related_entries sort="desc" orderby="date"}
              <a href="http://{title_permalink={my_template_group}/fine_art_detail}" title="{title}">{exp:ed_imageresizer_                image="{product_image}"_              default=""/images/site/image_coming_soon.jpg"_              maxWidth="50"_              maxHeigth="50"_              cropratio="1:1"_              class="borderimg"_              alt="Image description"} </a>
         {/reverse_related_entries} 
                  <!--END PRODUCT-->
                {/exp:weblog:entries}
  • #3 / Dec 17, 2010 4:15pm

    Boyink!

    5011 posts

    In order for this to work the following must be true:

    1. The relationship field is in the field group assigned to the products.
    2. Each product has been related to an artist.
    3. You are using the reverse related entries tag inside a weblog entries loop that is looping through the Artists weblog.
    4. The Products weblog is specified as a parameter on the reverse related entries tag.

  • #4 / Dec 17, 2010 4:23pm

    Eastwood Design

    605 posts

    In order for this to work the following must be true:

    1. The relationship field is in the field group assigned to the products.
    2. Each product has been related to an artist.
    3. You are using the reverse related entries tag inside a weblog entries loop that is looping through the Artists weblog.
    4. The Products weblog is specified as a parameter on the reverse related entries tag.

    I believe all are true.

    1. In my products weblog I have a field called artist that is a relationship to the artist weblog.  So when I enter a product in the product weblog I select an artist from the drop menu.

    2. What would happen if I entered a couple products and did not relate them to anything?  Would this cause failure? Actually I tried giving every product a related artist and still ALL products are being displayed not just the ones for the artist being displayed

    3. true

    {exp:weblog:entries orderby="date" sort="desc" limit="99" weblog="artists" dynamic="off" category="5" disable="member_data|trackbacks"}
                <!--START PRODUCT-->
    {reverse_related_entries sort="desc" orderby="date" weblog="Products"}

    4. true

    {reverse_related_entries sort="desc" orderby="date" weblog="Products"}
  • #5 / Dec 17, 2010 4:32pm

    Boyink!

    5011 posts

    Non-related products won’t cause a failure.  They just wouldn’t show up.  There are actually some built-in variables you can use {if_no_reverse_related_entries} if you want to display a message in those situations.

    I’d suggest stripping the tags all down to the bare minimum. Remove you orderbys and sorts, and the category parameter, etc.  Dynamic can be left on unless you have a specific need to turn it off. Get that image sizer code out of there - just leave the nested weblog:entries and reverse related entries tag pairs with the weblog parameter specified in both.  See if you can get just a list of Artist and product titles returned.

  • #6 / Dec 17, 2010 4:56pm

    Eastwood Design

    605 posts

    http://www.domain.com/indexee.php?/site/testing/walking_through_blue


    walking_through_blue is the url_title of the product I am displaying

    Trying to display the other products by the same artist:


    This gives me NOTHING

    {exp:weblog:entries weblog="artists" dynamic="on"}
                <!--START PRODUCT-->
    {reverse_related_entries  weblog="Products"}
            {title}
         {/reverse_related_entries} 
    {if no_reverse_related_entries}
      Nothing else for this artist
     {/if}
                  <!--END PRODUCT-->
                {/exp:weblog:entries}

    This gives me EVERYTHING even the products related to a different artist

    {exp:weblog:entries weblog="artists" dynamic="on"}
                <!--START PRODUCT-->
    {reverse_related_entries  weblog="Products"}
            {title}
         {/reverse_related_entries} 
    {if no_reverse_related_entries}
      Nothing else for this artist
     {/if}
                  <!--END PRODUCT-->
                {/exp:weblog:entries}


    The only different between the 2 is dynamic=“on” and “off”

    scratching head??

  • #7 / Dec 17, 2010 5:56pm

    Boyink!

    5011 posts

    Try this:

    {exp:weblog:entries weblog="artists"}
    Artist: {title}
     {reverse_related_entries  weblog="products"}
            {title}
    
    {/reverse_related_entries}  
    {/exp:weblog:entries}

    I do note you have the products weblog capitalized “Products”.  Keep in mind EE is case sensitive in this respect.

  • #8 / Dec 17, 2010 6:49pm

    Eastwood Design

    605 posts

    Try this:

    {exp:weblog:entries weblog="artists"}
    Artist: {title}
     {reverse_related_entries  weblog="products"}
            {title}
    
    {/reverse_related_entries}  
    {/exp:weblog:entries}

    I do note you have the products weblog capitalized “Products”.  Keep in mind EE is case sensitive in this respect.

    gives me nothing.

    yes I know about the products/Products.  Products is the correct weblog.  Thanks

  • #9 / Dec 17, 2010 6:58pm

    Boyink!

    5011 posts

    Nothing means not even artist names?

    What’s the URL this template is being loaded at?

  • #10 / Dec 17, 2010 7:13pm

    Eastwood Design

    605 posts

  • #11 / Dec 18, 2010 10:33am

    Boyink!

    5011 posts

    So - just so I understand, the goal here is to show “other artwork by this artist” on a detail page for a piece of art?

    In other words - you’re trying to use relationships to “show siblings”?

    If that’s the case then relationships aren’t necessarily the easiest way to do that as they are inherently a way to show parents info for a child or vice/versa.

    Did you investigate categories?  You could run an artist as a category, and then use the related categories mode to show the other artwork.

    Otherwise I think we can get relationships to work but will need to make use of embedded templates and embed variables.

  • #12 / Dec 18, 2010 10:41am

    Eastwood Design

    605 posts

    I would really rather not use categories as I will have about 50 artists and I am using categories for another reason.  I have not used embedded variables before.  Where would I even start?

  • #13 / Dec 18, 2010 11:07am

    Boyink!

    5011 posts

    The docs are usually a good place..😉

    I also have a few tutorials using them.

    I’d suggest playing around with them a bit and seeing how they work, then I can outline the basic approach that I think will work in this specific case.

  • #14 / Dec 19, 2010 3:12pm

    Greg Salt

    3988 posts

    Hi Eastwood Design,

    Can you please detail your custom fields for artists and Products weblogs, showing explicitly where you have your relationships set up.

    Cheers

    Greg

    @Mike, thanks very much for the help!

  • #15 / Dec 20, 2010 9:11am

    Eastwood Design

    605 posts

    Here are 3 screenshots.

    One is the field group for the weblog artists
    next is the field group for the weblog Products
    next is the relationship custom field in Products where I pick the artist when adding a new product

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases