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

    I have built a product catalog using just documents, TV’s and a ditto call but i’m having a small problem.
    In total there are about 15 different TV’s and over 50 products.

    My problem is this: Some products only use 3 or 4 of the TV’s, whilst other products may use all of the TV’s.
    I would prefer NOT to have to create multiple templates and then assign products to the relevant template.

    Is there a way to have all TV’s assigned to one template/product and just hide them if they are not used by a particular product? also i have a chunk that contains HTML code for the product page layout, here’s an eg:
          <tr>
            <td>Engine:</td>
            <td>[+engine+]</td>
          </tr>
    


    I somehow need to hide the Engine: title when there is no engine associated with the product.

    Sorry all, i hope i’ve made sense here

    G
      • 26016
      • 561 Posts
      Hi,
      Yes, I think I follow that. The first thought I had was to install and use PHx, and here are a few ideas for that:

      http://www.gregorysmart.com/2009/06/18/hide-empty-modx-tvs-in-ditto/

      Cheers, Dave
        MODx and Wordpress development
        Linux, PHP 5.2, MySQL 5.0, Evo 1.05, Revo 2.08-pl, Firefox 4
        • 10489
        • 93 Posts
        Hi Dave,

        Thanks so much....looks like it’s what i need but i can’t get it working. Also when i installed PHx, all of a sudden my next/previous page is not working. Here’s my code (chunks)

        CHUNK - {{list}}
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="250"><p align="center">[+longtitle+]<br>
            <img src="[+image+]" width="100" height="100" alt="[+desc+]" /></p>      </td>
            <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td> </td>
                <td> </td>
              </tr>
              <tr>
                <td> </td>
                <td> </td>
              </tr>
              <tr>
                <td> </td>
                <td> </td>
              </tr>
              <tr>
                <td width="200">Operating Weight: </td>
                <td>[+operatingweight+]</td>
              </tr>
              <tr>
                <td>Working Width: </td>
                <td>[+workingwidth+]</td>
              </tr>
              <tr>
                <td>Impact Force: </td>
                <td>[+impactforce+]</td>
              </tr>
              <tr>
                <td>Frequency:</td>
                <td>[+frequency+]</td>
              </tr>
              <tr>
                <td>Engine:</td>
                <td>[+engine+]</td>
              </tr>
              <tr>
                <td> </td>
                <td> </td>
              </tr>
              <tr>
                <td> </td>
                <td> </td>
              </tr>
            </table></td>
          </tr>
        </table>
        <div id="dotted"></div>
        <div style="clear: both;"></div>

        Just excuse the table layout... smiley This is where i need to include Greg Smart’s PHx solution.
        EDIT: i got Dave’s solution working. Still stuck on the previous/next issue

        Previous/Next - Not working since installing PHx
        [!Ditto? &tpl=`list` &parents=`16` &paginate=`1` &paginateAlwaysShowLinks=`1` &summarize=`3` &sortBy=`pub_date` &sortDir=`asc`!]
        
        Showing [+start+] - [+stop+] of [+total+] Products | Page [+currentPage+] of [+totalPages+]
         
        [+previous+] [+pages+] [+next+] 


        Thanks for the help
        Garth
          • 26931
          • 2,314 Posts
          Previous/Next - Not working since installing PHx
          try setting the ressource to "uncached"
            • 10489
            • 93 Posts
            Hi Sharkbait,

            No luck....! Here is my document tree:
            Products
            >>Category 1
            >>>>Category 1 - product 1
            >>>>Category 1 - product 2
            >>>>Category 1 - product 3
            and so on.......

            I tried setting Products, Category 1 as well as all product 1,2,3 to "uncached" but with no luck.

            Any other ideas??

            Thanks
            Garth
              • 10489
              • 93 Posts
              Hi Guys,

              Got the previous and next links showing, had to use a cached ditto call.
              but they don’t actually work...when clicked the page refreshes but stays on the current page, which is page 1

              ??

              Cheers
              Garth
                • 10489
                • 93 Posts
                Hi,

                Can anyone help with this?

                thanks
                Garth
                  • 26016
                  • 561 Posts
                  My advice to you: it’s generally best not to doubt Sharkbait. He’s super smart. smiley

                  This is where it gets very hairy with Ditto, and it has caused me immense frustration at times. Page cache handling is a black art. It’s hard to know without being in your system, but here’s what it looks like to me.

                  Here’s a test plan: First, to be safe, uncache the 3 product documents. Now it’s time to play with the root.

                  To get Prev/Next working on a Ditto root page, something will DEFINITELY need to be uncached. First try uncaching both the Ditto root document AND its Ditto call.

                  To check each page, I like to do Shift-Refresh (I have Windows) to be sure I’m getting a new page load. I don’t know what this is on a Mac or Unix box. Can’t hurt to clear the whole browser cache first, too.

                  Try the "double-uncached" page. If that doesn’t make Prev/Next work, try uncaching the call, and test again (with Shift or whatever). If that’s doesn’t work, re-cache the call, and uncache the page, and try again.

                  That’s my best suggestion.

                  Even though I’ve built loads of sites using Ditto calls fancy and simple, in my experience the cached-uncached combos have been confusing and unpredictable.

                  Good Luck, D

                    MODx and Wordpress development
                    Linux, PHP 5.2, MySQL 5.0, Evo 1.05, Revo 2.08-pl, Firefox 4
                    • 10489
                    • 93 Posts
                    Hi Dave,

                    Thanks for your reply. I don’t doubt Sharkbait at all smiley or anyone on the forums as i know they probably know a lot more than me, lol

                    Well Susan Ottwell helped me solve this issue, i will post the solution, with her permission of course, tommorrow.
                    Also going to try your solution, it’ll bug me if i don’t. Will let you know how i get on

                    Cheers
                    Garth
                      • 28042 ☆ A M B ☆
                      • 24,524 Posts
                      Sure; no problem. Everybody here should know my opinion of the PHx plugin by now wink
                        Studying MODX in the desert - http://sottwell.com
                        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                        Join the Slack Community - http://modx.org