<p>Well as always with Craft there are many ways to skin this particular cat.  </p>

<p>A simple approach would be to have a catalogue template (either just one for all product types or separate ones for each product type if you want to vary the format significantly).</p>

<p>Assuming just one template for your various catalogues, this could live in your  templates folder at e.g. <code>_site/product-catalogue.html</code></p>

<p>You could set up a route in Settings->Routes, such that </p>

<p><code>*/catalogue</code> pointed to  <code>/_site/product-catalogue</code></p>

<p>this template would then load whenever someone went to e.g.</p>

<p><code>yoursite.com/monitors/catalogue</code></p>

<p>In there you could query for all products of that type and display them:</p>

<pre><code>{% set segment_1 = craft.request.getSegment(1) %}
{% set products = craft.commerce.products.type(segment_1).find() %}
</code></pre>

<p>...and proceed from there any way you like, really, in terms of display.</p>

<p>In terms of building you nav:</p>

<pre><code>{% for productType in craft.commerce.productTypes %}
    &lt;li&gt;&lt;a href="/{{ productType.handle }}/catalogue"&gt;{{ productType.name }}&lt;/a&gt;&lt;/li&gt;
{% endfor %}
</code></pre>

<p>(Another approach would be to add all the products to a category, and then use category fields and a category template to display your product list).</p>

<p>I haven't used tags much, and I am not sure I'm 100% on what you're asking (do you want to highlight sections with new products, or create an extra element in your nav for these?)....but in essense you'd probably have to search for products in that category and look for a tag of New.  Here's some sketch code:</p>

<pre><code>{% for productType in craft.commerce.productTypes %}
   results = search for entries with this type that have the tag New
   if the length of results &gt; 0
      &lt;li&gt;&lt;a href="/productType.handle/catalogue"&gt;*** NEW *** {{ productType.name }}&lt;/a&gt;&lt;/li&gt;
   else
      &lt;li&gt;&lt;a href="/productType.handle/catalogue"&gt;{{ productType.name }}&lt;/a&gt;&lt;/li&gt;
   endif
{% endfor %}
</code></pre>

<p>Craft docs on doing the search are here: <a href="https://craftcms.com/docs/searching" rel="nofollow">https://craftcms.com/docs/searching</a></p>

CC BY-SA 3.0
2016-07-07T08:56:42.220Z
Thank you very much for your help. I will dive into routes to get this working! 
I want to have an additional link in the navigation when a certain tag is used for a product. I solved it like that:
`{% if 'New' in craft.tags.group('productTags') %}
<li><a href="/collection/tags/new">New In</a></li>
{% endif %}`
obs
CC BY-SA 3.0
2016-07-07T04:20:47.007Z
2016-07-07T09:35:59.800Z
2016-07-07T09:35:59.800Z
Jeremy Daalder
<p>I'm pretty new to Craft and Craft Commerce and right now I'm struggling with the following: in the navigation I want a list item for every product type. This works with the following code:</p>

<pre><code>{% for productType in craft.commerce.productTypes %}
    &lt;li&gt;{{ productType.name }}&lt;/li&gt;
{% endfor %}
</code></pre>

<p>But how can I now link this product type to an collection template and show only products of this type?</p>

<p>And the second question is: If at least one product has the tag "new" I want a list item for this in the menu as well. I created a tag field for this. But how can I now check if there are products with this tag and can I link this to an collection template as well?</p>

<p>Thanks for your help!</p>

<plugin-craftcommerce><tags>
Product Type Collections & Tags
# Product Type Collections & Tags

(Asked by: username_0 on 2016-07-06)

I'm pretty new to Craft and Craft Commerce and right now I'm struggling with the following: in the navigation I want a list item for every product type. This works with the following code:
{% for productType in craft.commerce.productTypes %}
    {{ productType.name }}
{% endfor %}

But how can I now link this product type to an collection template and show only products of this type?
And the second question is: If at least one product has the tag "new" I want a list item for this in the menu as well. I created a tag field for this. But how can I now check if there are products with this tag and can I link this to an collection template as well?
Thanks for your help!

**Tags:** plugin-craftcommerce, tags


---

## 1 answers

### Answer by username_1 on 2016-07-07. Score: 1 | Accepted answer

Well as always with Craft there are many ways to skin this particular cat.  
A simple approach would be to have a catalogue template (either just one for all product types or separate ones for each product type if you want to vary the format significantly).
Assuming just one template for your various catalogues, this could live in your  templates folder at e.g. _site/product-catalogue.html
You could set up a route in Settings->Routes, such that 
*/catalogue pointed to  /_site/product-catalogue
this template would then load whenever someone went to e.g.
yoursite.com/monitors/catalogue
In there you could query for all products of that type and display them:
{% set segment_1 = craft.request.getSegment(1) %}
{% set products = craft.commerce.products.type(segment_1).find() %}

...and proceed from there any way you like, really, in terms of display.
In terms of building you nav:
{% for productType in craft.commerce.productTypes %}
    {{ productType.name }}
{% endfor %}

(Another approach would be to add all the products to a category, and then use category fields and a category template to display your product list).
I haven't used tags much, and I am not sure I'm 100% on what you're asking (do you want to highlight sections with new products, or create an extra element in your nav for these?)....but in essense you'd probably have to search for products in that category and look for a tag of New.  Here's some sketch code:
{% for productType in craft.commerce.productTypes %}
   results = search for entries with this type that have the tag New
   if the length of results > 0
      *** NEW *** {{ productType.name }}
   else
      {{ productType.name }}
   endif
{% endfor %}

Craft docs on doing the search are here: https://craftcms.com/docs/searching

> **Comments:**
> **username_0**: Thank you very much for your help. I will dive into routes to get this working!  I want to have an additional link in the navigation when a certain tag is used for a product. I solved it like that: `{% if 'New' in craft.tags.group('productTags') %} <li><a href="/collection/tags/new">New In</a></li> {% endif %}`  

---

