We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 50574
    • 70 Posts
    Hello

    I have a set of products and each one can be grouped within a minimum of two categories. I've created a checkbox TV for the products that allows you to choose which categories it fits in so when you go to the category page it will list all the relevant products.

    My question is that without having to duplicate each product within each category folder can I use the checkbox TV info to affect the breadcrumb/FURL and show the path to the product depending on which category page you come from rather than having a physical product within each category?

    The file structure I'd like to use is similar to:

    Products Container
    - Product1
    - Product2
    - Product3
    - Product4
    - Product5
    - Category1
    - Category2
    - Category3
    - Category4
    - Category5

    And still be able to get a breadcrumb/FURL path of home > products container > category1 > product1

    Rather than having to do:

    Products Container
    - Category1
    ---- Product1
    ---- Product2
    ---- Product3
    - Category2
    ---- Product1
    ---- Product4
    - Category3
    ---- Product2
    - Category4
    ---- Product1
    ---- Product2
    ---- Product5
    - Category5
    ---- Product4
    ---- Product5

    Thanks in advance
      • 30585
      • 833 Posts
      The breadcrumb part is relatively easy. There are probably better ways of doing this, but one easy way would be to hardcode the path. Let me explain:
      // You could place the following in a [[$Breadcrumb]] chunk, that you'd then use in your template
      <ol class="breadcrumb">
        <li><a href="[[++site_url]]" rel="home">Home</a></li>
        <li><a href="[[~<productsid>]]">Products</a></li>  
        <li><a href="[[~<categoryid>]]">Category</a></li>
        <li>Product</li>
      </ol>

      This can also be done with a snippet.

      You'll need to put in some extra effort to manipulate the URL as described for the FURL part. You might need to look into HTML5's History/State API. History.js seems very useful for this.
        A MODx Fanatic