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

    I am wondering if it'd be possible to duplicate a resource without physically doing so. For example, I have 15 products, each with their own resource, and I then have 5 'category' resources which are populated by these products. Some of the products however can be in two categories (or more) at the same time.

    My current site structure is along these lines:

    Full range resource/container
    -> Product resources x 15
    -> Category resources x 5

    The initial 'full range' page is populated by the products within it in the site structure using getResources, simple. I then have a TV which populates a checkbox list of the 5 categories within the product resource. The product will then populate the category resource relevant to it's selected checkboxes.

    All fine. It works, apart from the SEO side of needing the pretty URLs to follow the site structure – www.domain.com/range/category1/product1.html – but because the product is only seen as being inside the range it currently shows as www.domain.com/range/product1.html no matter whether the user came to it via a category page or not.

    As I understand I would need to create containers for each category and then put physical (duplicate) resources into each category that the product is related to. If the site has 200 products and 50 categories it would become rather cumbersome to make a change to one product across all the categories it is in.

    My question is this, can I either:
    'mirror/link' a physical resource across all it's relevant categories in the site structure so it only needs to be edited in one place to affect all the 'linked' resources?
    or
    Make the site know where the user has come from to affect the URL correctly using the current setup of TV and single product resource?

    Thanks in advance

    This question has been answered by cottoncreative. See the first response.

    • discuss.answer
      • 50574
      • 70 Posts
      Hello again

      After a little more digging the answer was right in front of my face... Symlinks.
      Then using the snippet written by @kctechsoln in the following post
      http://forums.modx.com/thread/78156/symlinks-getresources
      I can pull all the TVs in from the symlinked resource.
        • 3749
        • 24,544 Posts
        I'm not sure I understand your use case, but you have you looked at weblinks? They will use the Template and URL of the target rather than the current page.
          Did I help you? Buy me a beer
          Get my Book: MODX:The Official Guide
          MODX info for everyone: http://bobsguides.com/modx.html
          My MODX Extras
          Bob's Guides is now hosted at A2 MODX Hosting
          • 50574
          • 70 Posts
          Thanks Bob

          I think, essentially, I was after a way of duplicating resources and then only needing to make changes to the original resource to affect all it's duplicated ones, e.g. Change longtitle on the original and it changes on all it's duplicates too.

          I hadn't looked into Weblinks because the Symlink seemed to do the trick and was able to pull in all the TVs from the original and populate the duplicate page as well as any getResource calls I had relating to the original. Do web and symlinks do a similar thing?

          The project has since changed tack so I don't need the duplicates but it's always good to learn these things for future.
            • 3749
            • 24,544 Posts
            Weblinks and Symlinks are very similar. Symlinks pull the other resource into the current one (using the current template and URL). Weblinks display the other resource with it's own template and URL.

            Weblinks can also be used for off-site resources, Symlinks can't.
              Did I help you? Buy me a beer
              Get my Book: MODX:The Official Guide
              MODX info for everyone: http://bobsguides.com/modx.html
              My MODX Extras
              Bob's Guides is now hosted at A2 MODX Hosting