We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 15871
    • 105 Posts
    I’ve got a standard Dir structure of products and want to be able to set a TV on a product page so I can share that product with other categories. Using Ditto, I want to display all of the designated products under a specific Parent (Category) with any other documents set to also display in that category. I’m using pagination so 2 Ditto calls on the same page won’t work.

    What’s the best way to accomplish this?
      • 20413
      • 2,877 Posts
      By giving each Ditto call an &id=`cars` you can then use pagination placeholders like [+cars_next+]
      in order to have multiple calls with pagination.

      http://ditto.modxcms.com/tutorials/pagination.html

      Then for the TV you maybe could use some tagging: http://www.vimeo.com/929777?pg=embed&sec=929777

      //The embedded clip on http://ditto.modxcms.com/screencast/tagging.html is not as clear and nice
        @hawproductions | http://mrhaw.com/

        Infograph: MODX Advanced Install in 7 steps:
        http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

        Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
        http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower
        • 15871
        • 105 Posts
        Hi mrhaw, I’ll give it a shot and let you know how it works out.

        Thanx,
        Chuck
          • 15871
          • 105 Posts
          HI,
          What I’m looking to do is to have all the results together in the single list, not separated. And be able to paginate them at 8 per page. For example, here’s the layout now:

          Sofas: product1, Product2, product3
          Specialty Products: Product4, Product5, Product6


          I want to display Product4 (from Specialty Products) under the Sofa Category as well. I set up a TV for "Additional Categories" that I can select which other categories I want the product to display in.

          I have the main Ditto Call which works fine:
          [[Ditto? &tpl=`tpl.category` &paginate=`1` &display=`8` &paginateAlwaysShowLinks=`1`]]

          I tried adding filters to that call, like this so I could display all products set to show in the chosen category:
          [[Ditto? &parents=`47` &tpl=`tpl.category` &paginate=`1` &display=`8` &paginateAlwaysShowLinks=`1` &filter=`ShowInCategory,[*id*],1`]]

          Which successfully places only products with the matching parent id to display.

          So good, now I tried to put it together, but it doesn’t generate any matches. Logically, I am trying to say, Get a list of ALL products (47 is the id of the "collection", but exclude ones whose parent doesn’t match the current page id (the current category) OR any products that aren’t set to display in this category.

          [[Ditto? &parents=`47` &tpl=`tpl.category` &paginate=`1` &display=`8` &paginateAlwaysShowLinks=`1` &filter=`parent,[*id*],1|ShowInCategory,[*id*],1`]]
            • 4172
            • 5,888 Posts
            All your documents are in the folder 47 ? If not, then you have to set all possible parents in &parents, I think.
              -------------------------------

              you can buy me a beer, if you like MIGX

              http://webcmsolutions.de/migx.html

              Thanks!
              • 7231
              • 4,205 Posts
              I recently worked on a project where all documents culd be tied to each other via tags. Need to use parents=`0` to get all of the documents.
                [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

                Something is happening here, but you don't know what it is.
                Do you, Mr. Jones? - [bob dylan]
                • 4172
                • 5,888 Posts
                OK, but then, I think, you need also the parameter &depth=`0`
                  -------------------------------

                  you can buy me a beer, if you like MIGX

                  http://webcmsolutions.de/migx.html

                  Thanks!
                  • 15871
                  • 105 Posts
                  Yes, all the documents are under 47. The stickiness comes into play in that I need to get all the documents for the active folder AND any other documents that have the ShowInCategory TV set to that folder id as well. The concept is similar to tagging I guess.

                  The other thought I had was to have a listbox that just stated "Show in these categories" and have the listbox default to the parent id. But I couldn’t figure out how to to generate that with an @binding for the default value.

                  I used the following SQL statement to generate the list: @SELECT pagetitle,id FROM modx_site_content WHERE deleted != 1 AND hidemenu != 1 AND parent = 47 ORDER BY `pagetitle` ASC

                  ...and that works great. But how would a force the dfault to be the parent ID, so the client didn;t need to manually choose the category?

                  Going this route, would allow me just to filter based on the ShowInCategory TV, and I;d be set.

                  Chuck
                    • 15871
                    • 105 Posts
                    OK, going back to my original idea of a listbox, I have a TV that gets all the categories from the "Collection" section on the site. Now what I need to do is set the default of that listbox TV to each document’s parent. Thus allowing me to make multiple selections for categories to display in.

                    What would I need to put in the default text area? The research I have done seems to suggest an @EVAL statement like this: @EVAL return $_GET[’parent’];

                    but it is not working.

                    Any thoughts?