We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 35764
    • 35 Posts
    not sure if this is the correct place to post this as this is my first post!

    I’m going to use the ditto snippet for a product catalog, but need some guidance about how to build it in the best way. I have many categories and sub categories and in some places 3 categories deep (i.e category -> category1 -> category1a).

    My client wants to be able to add products in the right category then display it in the correct place.

    Thank you for any help and advice you may have building product catalogs.

    Lisa smiley
      • 21395
      • 91 Posts
      With Ditto and the tagging extender you can do this, and what’s more you can have products in more than one category if you wish.

      (A book on fishing could be under "books" and "fishing" for example).

      Product-categorisation is difficult. It is common for a manufacturer and a customer NOT to have the same idea about how things should be categorised. What is obviously-simple for one person is odiously obscure to another. Tagging gives a certain fuzziness that can rapidly improve your chances as the website designer of delivering what the viewer wants to see.

      This site uses a mixture of categorisation and tagging: http://www.stormforcemarine.com

      The client is a distributor; There is one page per manufacturer, each manufacturer makes one or more kinds of product. Different sets of tag-field are used to provide two different ways of accessing sub-sets of pages. One selects on "Commercial" or "Retail" etc. The right hand-menu uses Wayfinder to find landing pages that call Ditto filtered on the tag represented by the alias of the landing page.

      The other selects by product type across all manufacturers, again, Wayfinder selects landing pages that have Ditto calls that select products based on the [*pagetitle*] of the landing page, which is a comma-deliminated list of tags to call. The left-hand menu. The Ditto result is fully-tagged: manufacturers who make multiple products might have 5 to 10 tags. These serve to suggest things to the viewer and the taglinks are very quick indeed at selecting new sets of data to view.

      This is much less clumsy than it looks, and it is client-editable - no need to use me to change menus etc. The Ditto Calls are all via chunks in the template.

      So we have some hierarchical organisation, and tagging to leap sideways through the hierarchy.

      To do a pure catalogue I would place all the products in one huge container, and use one big tag field to indicate categories, sub-categories and the sub-subs.

      Lets take Food as an example.

      Category Level
      Meat
      Vegetables
      Fruit
      Dairy

      Sub category
      Green Vegetables
      Root Vegetables

      Sub-sub
      Lettuce
      Cabbage
      Beans


      A French Bean is tagged: Vegetable, Green, Beans
      A Tomato is tagged....ah! Not Green, and technically it’s a fruit. Tag it Vegetable, Fruit, Tomato. Add "Tomato" to the tag list. Put your tags in a TV.

      This site, in development, using Revo (because Evo/YAMS isn’t easy to use with multi-lingual tagging) has 45 categories so far and any individual property can have them all. http://property.boyde.com

      I have not used any categorisation page structure at all. Everything is in one flat folder, the rh menu is a list of all tags actually-used in a ul/li tag cloud and that’s it. The menu therefore has no blank results and all the results of searches are fully tagged so viewers can leap through the site gazelle-like as their fancy takes them. When in doubt about how to describe a particular property, (House? Cottage?) we classify it under both.

      In the example case the tag "Vegetable" gets you all the vegetables, and no meat or fruit. You get tomato: it’s a vegetable too. Or just click the "tomato" tag and cut to the chase. If for some reason you’ve unpublished your tomato page, no link or tag shows up. No more broken menus or blank-result menus.

      Not sure whether you want potatoes or yams - click "root".

      You avoid imposing your idea of order on your clients. If you have 7,000 product lines, however, as in the first example, than a little order might be called for...


      Good luck.
        MODX Revolution 2.6.5-pl (traditional)

        Hosted on MODX Cloud

        Skype: nicbaldeagle
        • 35764
        • 35 Posts
        thank you very much for your reply, much appreciated. Where do I find the tagging extender?

        thanks again

        Lisa
          • 21395
          • 91 Posts
          Start here:

          http://ditto.modxcms.com/extenders.html
          http://ditto.modxcms.com/extenders/tagging.html
          http://ditto.modxcms.com/files/assets/snippets/ditto/extenders/tagging-extender-inc-php.html

          The Wiki has gone down, so you might have to read the documentation the hard way.

          Here’s a typical Ditto call:

          [!Ditto? &parents=`1`&depth=`3`&orderBy=`pagetitle ASC`&tpl=`dittoTpl`&paginate=`1`&paginateAlwaysShowLinks=`1`&display=`10`&hideFolders=`1`&extenders=`tagging`&tagData=`ProductTypeSelector`&tags=`[*pagetitle*]`&tagDelimiter=`,`&tagDisplayDelimiter=` `!] Showing [+start+] - [+stop+] of [+total+] Titles | Page [+currentPage+] of [+totalPages+] [+previous+] [+pages+] [+next+] 


          Which translates as:

          Use Ditto, all documents below and not including ID=1, to a depth of 3 levels and order by pageTitle in ascending order. Template the results using chunk dittoTpl and paginate, with links, in blocks of 10. Don’t show any intervening folders (ie, container resources). Add in tagging functionality (this is redundant, using "&tags=`something`" automatically adds this functionality), look at a TV called ProductTypeSelector (a checkbox or multi-list select box) at product page level, which specifies what tags each product has (fruit, vegetable etc), and filter out anything that doesn’t have the value(s) in &tags. In this case we are using the pagetitle of "category" pages to store tag names separated by commas, so we specify [*pagetitle*] and tell Ditto it is comma-delimited, and also tell it display tags, when we do the output, separated by spaces. We then specify some formatting for the pagination process.

          This example is from the tagging-within-hierarchy site.

          Ditto is enormously powerful - such a shame to see it used chiefly for blogging. I haven’t begun to explore its scope...

          Good luck.
            MODX Revolution 2.6.5-pl (traditional)

            Hosted on MODX Cloud

            Skype: nicbaldeagle