We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8454
    • 55 Posts
    That’s of course much more compact, KP, and what I am used to from Wayfinder. Thanks.

    Will it work with friendly URLs? I’m on a local MAMP, don’t know how to "write a .htaccess file" and cannot test that.
      • 36416
      • 589 Posts
      Quote from: kp52 at May 13, 2009, 03:29 AM

      and the contents of myparameters.config.php:
      <?php
      $filter=’ProductGroup,’ . $_GET[’frompage’] . ’,7’;
      $tpl=’ColumnItem’;
      $tplCurrentDocument=’CurrentColumnItem’;
      ?>
      Tidier and easier to maintain than an extra mini-snippet.

      This is even better:
      $tpl = '@CODE <div class="ditto_item" id="ditto_item_[+id+]"> ... </div>';

      to keep those pesky designers out of your presentation layer. tongue
        • 36416
        • 589 Posts
        Quote from: eddygrove at May 13, 2009, 03:26 AM

        I needed it for products belonging to multiple groups in a catalog, eventually e-commerce site, where a plain document tree and Wayfinder wont do. Will it look amateurish or even be potentially unsafe to show variable passing in the URL in a live site?

        No and potentially yes, I’d say.
        Ditto probably does multiple groups better and safer with tagging:
        http://ditto.modxcms.com/extenders/tagging.html
        http://ditto.modxcms.com/screencast/tagging.html
          • 8454
          • 55 Posts
          That’s very compact, Eol, saves me the trouble of managing different language chunks as well. It’s getting better by the hour...

          Tried tags before however, much due to the fact there was an outstanding screencast. But I need the Product Groups to be managed by checkbox TVs, which didn’t play well with tagfiltering, see also:
          http://modxcms.com/forums/index.php/topic,31433.msg190648.html#msg190648
            • 8454
            • 55 Posts
            One more thing. When I move on to another product in the group, from the landing page, I need to pass the initial product group pagetitle on, i.e. the value of "frompage", not the product pagetitle. I’ve tried all combos of homebrew psycho-php I can come up with, but can’t get the syntax right:
            $filter='ProductGroup,' . $_GET['frompage'] . ',7';
            $tpl='@CODE <div class="ditto_item" id="ditto_item_[+id+]">
            <div><img src="[+mainimage+]"></div>
            <h3 class="ditto_pageTitle"><a href="[~[+id+]~]&frompage=WHAT_TO_PUT_HERE?";">[+pagetitle+]</a></h3></div>';
              • 36416
              • 589 Posts
              Quote from: eddygrove at May 13, 2009, 05:03 AM

              Tried tags before however, much due to the fact there was an outstanding screencast. But I need the Product Groups to be managed by checkbox TVs, which didn’t play well with tagfiltering, see also:
              http://modxcms.com/forums/index.php/topic,31433.msg190648.html#msg190648

              Checkbox TVs in this context means predefined set of categories?
              You could install ManagerManager plugin with tag editing widget for your manager users:
              http://modxcms.com/forums/index.php/topic,16948.msg149773.html#msg149773
                • 36416
                • 589 Posts
                Quote from: eddygrove at May 13, 2009, 10:09 AM

                One more thing. When I move on to another product in the group, from the landing page, I need to pass the initial product group pagetitle on, i.e. the value of "frompage", not the product pagetitle. I’ve tried all combos of homebrew psycho-php I can come up with, but can’t get the syntax right:
                $filter='ProductGroup,' . $_GET['frompage'] . ',7';
                $tpl='@CODE <div class="ditto_item" id="ditto_item_[+id+]">
                <div><img src="[+mainimage+]"></div>
                <h3 class="ditto_pageTitle"><a href="[~[+id+]~]&frompage=WHAT_TO_PUT_HERE?";">[+pagetitle+]</a></h3></div>';


                Which landing page? To set initial value, you could do:
                $frompage = isset($_GET['frompage']) ? $_GET['frompage'] : $modx->documentObject['pagetitle'];
                $tpl = '...
                 <h3 class="ditto_pageTitle"><a href="[~[+id+]~]&frompage='.$frompage.'">[+pagetitle+]</a></h3>
                ...';
                

                  • 8454
                  • 55 Posts
                  Thank you so much for your help, sorry for not responding until now. It’s working as it should. I ended up using the pageid anyway, which of course works much better in an URL (e.g. no spaces or special characters). I added surrounding parentheses however to eliminate the problem with page id:s containing the same sequence, where unwanted docs would otherwise pass the multiple choice Ditto filter (7).
                  $filter='enProductGroup,' . $_GET['frompage'] . ',7';
                  $tpl='@CODE <div class="ditto_item" id="ditto_item_[+id+]">
                  <a href="[~[+id+]~]&frompage=' . $_GET['frompage'] . '"><div><img src="[+mainimage+]"></div>
                          <h3 class="ditto_pageTitle">[+pagetitle+]</h3></a>
                  The only remaining issue is that I need to manually edit the option list in the TV (for each language) when a new product group is added. The list looks something like this: All products (56)||Load carriers (58)||Pouches (59)||Slings and Holsters (63)||Backpacks and Bags (74)||Medical bags (88)... and for each product multiple options can be chosen.

                  I am sure that there is a way to construct this option list from the pagetitles and id:s in the database (with a @SELECT binding or a snippet?). This wiki article http://wiki.modxcms.com/index.php/%40SELECT_Binding is very informative, but more or less tells someone like me to keep away...
                  Any hints? Can I use Ditto in the back-end maybe?
                    • 36416
                    • 589 Posts
                    Quote from: eddygrove at Jun 03, 2009, 03:56 PM

                    Any hints? Can I use Ditto in the back-end maybe?

                    Yes, of course. Here is example of dynamic TV values:
                    http://wiki.modxcms.com/index.php/Create_TV-Based_Chunks#Create_the_Template_Variable
                      • 8454
                      • 55 Posts
                      Great, thanks, I hadn’t seen that article. I’ll try to figure out how to build something from that.

                      Another thing (never ends..), if I come to the "landing page" (i.e the page with a menu filtered by $filter=’enProductGroup,’ . $_GET[’frompage’] . ’,7’
                      without a "frompage" value, I obviously get a parse error: strpos() [function.strpos]: Empty delimiter

                      This happens if I come to the page via a search result (such as AjaxSearch) where of course no "frompage" variable is in the result link. Will I have to code a default "frompage" variable into each and every link, hard coded or dynamical, that points to pages with the above Ditto filter?
                      I have searched the Ditto documentation for a "catch all" solution, for example a parameter that points to a custom page in the case of a parse error or the like.