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

    Looking for some help here.

    What I have setup right now;

    Products (1)

    Categorie A (2)
    - Product 1 (4)
    - Product 2 (5)

    Categorie B (3)
    - Product 3 (6)
    - Product 4 (7)

    Now, on my homepage I want the user to select a resource from a dropdown (tv). I only want to show the products to my user.
    What would be the best way to do this? So I would like the user to go to Template Variables -> Products -> Select a product from the dropdown.

    Thanks.

    Coen
      • 3749
      • 24,544 Posts
      If I'm understanding you (and I'm not sure I am), you want the selected product to show if the user picks it and clicks on the Submit button.

      You'd want to put the dropdown in a form, then have a custom snippet that checked for submission of the form and displayed the correct product after checking the value of the $_POST member containing the value of the dropdown selection.
      The details of that would depend on where and how the product information is stored.
        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
        • 40906
        • 23 Posts
        Hi Bob,

        Thanks for taking the time to respond.
        I'm 100% sure it's my fault for the way I've explained. Let me try again.

        I have a page on my website names Products. This contains Categories and underneath there are Products. If my the user (on the website) goes to Products he will see all categories and products on 1 page.
        Now on the Homepage I would like show 1 product showcased to the frontend user.

        In the manager my client should go to Homepage -> Template Variables -> Product Showcase (my category) -> TV with a dropdown which only shows the products & not the categories.
        If I make the TV a document list and choose it's parent it shows "Categorie A, Product 1, Product 2, Category B, Product 3, Product 4, etc..". This confuses my client. I would like to show just "Product 1, Product 2, Product 3, Product 4, etc..".

        I hope this explains my question in a better way.

        Thanks again for the help.

        Coen

          • 3749
          • 24,544 Posts
          For the home page, you need a getResources tag with &limit=`1` &sortby=`RAND()`.

          I can't think of an easy solution for the other problem. I think it would have to be a custom TV or possibly a MIGX TV. I'm not that familiar with MIGX, but it might do that, or possibly show a grid with the category and product name in different columns, which would be better that what you have now.
            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
            • 36926
            • 701 Posts
            Quote from: coensiebenheller at Mar 03, 2017, 04:09 AM
            Hi Bob,
            If I make the TV a document list and choose it's parent it shows "Categorie A, Product 1, Product 2, Category B, Product 3, Product 4, etc..". This confuses my client. I would like to show just "Product 1, Product 2, Product 3, Product 4, etc..".

            Are the categories and products resources in the tree? As you could run a snippet as the TV snippet input, like
            @EVAL return $modx->runSnippet('mySnippet');