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

    I am using EVO 1.0.4 with Wayfinder 2.0

    I am building a website that has a nested product range with varying levels of depth where product items have optional template variables for pdf downloads.

    Here’s the background info...

    The product range is nested - eg:
    + product brand
     - product group
      * product item
      * product item
     - product group
      * product sub-category
       > product item
       > product item
      * product sub-category
       > product item
       > product item
     - product group
      * product item
      * product item


    Each product group page features a number of wayfinder calls that insert the pdf TV’s as relevant (thanks to the solution by ottogal on this page: http://modxcms.com/forums/index.php/topic,55031.msg316950.html#msg316950 )

    Those wayfinder calls (stored in chunks) work really well on the product group pages.

    The 3 optional "pdf download" template variables only exist for a handful of products at the moment:
    [+product-download-catalogue+] (id=11)
    [+product-download-install-manual+] (id=12)
    [+product-download-technical+] (id=13)


    Here comes the question...

    Say I have the following chunks which are wayfinder calls returning all relevant product data (part number / description / image / pdf downloads) for the various products and which are displayed on the relevant page for each brand:
    {{products-brand1-product1}}
    {{products-brand1-product2}}
    {{products-brand1-product3}}
    {{products-brand2-product1}}
    {{products-brand2-product2}}
    {{products-brand2-product3}}
    {{products-brand2-product4}}
    {{products-brand3-product1}}
    {{products-brand2-product2}}
    {{products-brand3-product3}}


    And at the moment, only 4 products actually have pdf downloads but more will be added in the future - Eg these currently have at least 1 pdf:

    {{products-brand1-product2}}
    {{products-brand1-product3}}
    {{products-brand2-product5}}
    {{products-brand3-product1}}


    On a downloads page, is it possible to dynamically include only those chunks for products where one or more of the "pdf download" tv’s exist?

    (Or excluding those chunks where a "pdf download" tv does not exist.)

    Perhaps this needs to be done with Ditto and filters but I am unsure how to do it?.

    I am absolutely lost as to how I could achieve this dynamically and warmly welcome any assistance.

    Thanks in advance.
      Web design Adelaide
      http://gocreate.com.au
      • 19369
      • 1,098 Posts
      I would do it in this way, if your chunks won’t contain a huge amount of data (Search PHx Parser Limits on google)

      [+pdfTv:isnot=``:then=`{{products-brand1-product1}}`+]
      [+pdfTv:isnot=``:then=`{{products-brand1-product2}}`+]
      [+pdfTv:isnot=``:then=`{{products-brand1-product3}}`+]
      [+pdfTv:isnot=``:then=`{{products-brand2-product1}}`+]
      [+pdfTv:isnot=``:then=`{{products-brand2-product2}}`+]
      [+pdfTv:isnot=``:then=`{{products-brand2-product3}}`+]
      


      But to be honest I’d use Ditto and Filters instead of Wayfinder. For example you can exclude the resource if the TV [*pdf*]does contain the text "pdf" on it:

      [[Ditto? &parents=`0` &filter=`tvpdf,pdf,8`]]
      


      http://ditto.modxcms.com/tutorials/basic_filtering.html
        • 22427
        • 793 Posts
        It seems a bit cumbersome to me using an own chunk for each combination of brand/product. Perhaps it’s possible to do it in a more dynamic way.
        I will come back to this (not so much time at the moment).
          • 21417
          • 486 Posts
          ok beauty - thanks Ottogal.
          I think you are right re cumbersome.
          I can give you a link when ready (that will give me time to finalise the css)
          Many thanks.
            Web design Adelaide
            http://gocreate.com.au
            • 21417
            • 486 Posts
            Thanks microcipcip.

            Where this gets a little tricky is the product items are currently displayed on a parent page, not on their own page, to group like items...

            So I think this kind of phx will not work as the parent page does not actually have a pdf assigned to it - that’s all with their children - hence [+pdfTv:isnot=``:then=`{{products-brand1-category}}`+] returns blank - otherwise at that level I would have to do one for every product and you’re right that would be taxing on me and the system.

            Perhaps ditto is the go.

            It would be wonderful if I could keep the hierarchy, but I believe that is not possible with ditto.

            The difference to your call is I need to filter with 7 ("does contain the text of the criterion").

            However, the filtering only works for me with one filter at a time - not all 3:

            This works for "product-download-catalogue" TV:
            [[Ditto? id=`ditto2` &parents=`10` &depth=`10` seeThruUnpub=`1` &filter=`tvproduct-download-catalogue,.pdf,7`]]


            This works for "product-download-install-manual" TV:
            [[Ditto? id=`ditto3` &parents=`10` &depth=`10` seeThruUnpub=`1` &filter=`tvproduct-download-install-manual,.pdf,7`]]


            This works for "product-download-technical" TV:
            [[Ditto? id=`ditto4` &parents=`10` &depth=`10` seeThruUnpub=`1` &filter=`tvproduct-download-technical,.pdf,7`]]


            I need to somehow combine the filtering so that any product with a "product-download-catalogue" TV and/or a "product-download-install-manual" TV and/or a "product-download-technical" TV is included - but I must have something wrong with the filter call as the following only returns one document (the one document that has all 3 TV’s populated ), not the 12 as expected:
            [[Ditto? id=`ditto1` &parents=`10` &depth=`10` seeThruUnpub=`1` &filter=`tvproduct-download-catalogue,.pdf,7|tvproduct-download-install-manual,.pdf,7|tvproduct-download-technical,.pdf,7`]]
            
            1

            Any ideas where I am going wrong?

            Thanks again.
              Web design Adelaide
              http://gocreate.com.au
              • 19369
              • 1,098 Posts
              The call looks ok, have you tried playing with cached/unacached snippet, cached/uncached page?
                • 21417
                • 486 Posts
                no, I hadn’t until you asked - I unchecked the "cacheable" checkbox on a couple of the products and the downloads page (I couldn’t see where to do it for Ditto) but that doesn’t seem to make a difference.

                If the calls look good I must be close...

                I wonder what it’s not working with all 3 tv statements in the filter then?
                  Web design Adelaide
                  http://gocreate.com.au
                  • 19369
                  • 1,098 Posts
                  I’ll try to reproduce your products structure, it’s difficult to see where’s the mistake without trying. I’ll let you know if I find the solution.
                    • 21417
                    • 486 Posts
                    Thanks microcipcip.
                      Web design Adelaide
                      http://gocreate.com.au
                      • 22427
                      • 793 Posts
                      Any ideas where I am going wrong?
                      It’s a problem of logic.
                      (Following I will use abbreviations A, B, C for better readability.)
                      Your filter
                      &filter=`A,.pdf,7|B,.pdf,7|C,.pdf,7`
                      would exclude those documents fulfilling the condition
                      (A does not contain .pdf) OR (B does not contain .pdf) OR (C does not contain .pdf)
                      But you want to exclude the docs fulfilling
                      (A does not contain .pdf) AND (B does not contain .pdf) AND (C does not contain .pdf)
                      You could think of a double negation - having in mind the example
                      not(raining OR snowing) = (not raining) AND (not snowing)
                      So your condition would become
                      not( (A does contain .pdf) OR (B does contain .pdf) OR (C does contain .pdf) )
                      The inner part then would become
                      A,.pdf,8|B,.pdf,8|C,.pdf,8
                      But now I must admit that I don’t know how to put in the outer negation... sad
                      By the way: In your Ditto calls you have [tt]seeThruUnpub=`1`[/tt] instead of [tt]&seeThruUnpub=`1`[/tt]