1

We're build a shop and want to output similar products using categories, everything is now working apart from the related products. It's currently just outputting the latest 5 products that have been added, they don't belong to the same category at all so i'm pretty confused as to why this would happen? We have the following code:

{exp:channel:entries related_categories_mode="yes" custom_fields="yes" limit="5"}
{if count == 1}
<div class="related-products">
  <h2>Related products</h2>
  <ul class="product-list">
{/if}
  <li>
    <article>
      <a href="/products/{url_title}">
        <span class="product-image">
          {product_image limit="1"}
            <img src="{image:medium}" alt="{title}" height="" width="" />
          {/product_image}
        </span>
        <span class="product-text">
          <h3>{title}</h3>
            {exp:store:product entry_id="{entry_id}" disable_form="yes" disable_javascript="yes"}
            {if on_sale}
              <div class="sale-label">Sale</div>
              {price}
              {if:else}
              {regular_price}
              {/if}
            {/exp:store:product}
        </span>
      </a>
    </article>
  </li>
  {if count == total_results}
    </ul>
  </div>
  {/if}
{/exp:channel:entries}  

I've tried using dynamic="no" and url_title="{segment_2}" together but this brings up the no matches, any ideas would be appreciated.

1
  • Is this exp:channel:entries inside another exp:channel:entries?
    – Sobral
    Oct 22 '13 at 14:57
2

You may need to add the channel="" parameter to your channel:entries tag.

3
  • Thanks for the suggestion, turns out I was being stupid and all products belonged to the same Tax category, hence why everything was being output, had to do category_group="not 8" and all was fine. Silly me :(!
    – Nick
    Oct 23 '13 at 9:08
  • Ah ha! Nice job tracking that down.
    – Anna_MediaGirl
    Oct 23 '13 at 15:41
  • NOTE: I'm locking this answer because it keeps getting edited by spammers.
    – Anna_MediaGirl
    Jan 22 '15 at 22:21
1

Turns out all products belongs to a tax category so it was thinking everything was related, had to disable that category from the output then all was fine!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.