Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Fredrik 89 posts 108 karma points
    Oct 26, 2010 @ 08:55
    Fredrik
    0

    Using one page to display information from various node-childs

    I want to display products.

    My content structure looks like this.

    Products

       Product Category 1

          Product 1

          Product 2

       Product Category 2

           etc..

     

    When Product Category 1 is clicked in the menu I want to only view the products listed under that node.

    Here is the problem:

    I don't want to use a page for each product category....if I were to create a page as a standard asp.net solution I would use only one page for products and send parameters in the redirect that I would then use to specify which products to view.

    When using umbraco and with this data structure I find it harder. My solution right now is to create pages for each of the product categories where I use xslt-macros that are also made for the specific Product Category(Listing all information from the nodes under the specific Product Category-node-ID).

    Isnt there another(easier) way of doing this?

  • Kim Andersen 1447 posts 2197 karma points MVP
    Oct 26, 2010 @ 17:29
    Kim Andersen
    0

    Hi Fredrik

    Have I understod you right if I think that you have seperate templates/macros for each of the product category-nodes (meaning three templates and three macros if you have three product category-nodes)?

    You should be able to create just one template and use one macro on that template. Then the template should be used on all of the product category-pages (meaning only one template and one macro for three product category-nodes).

    But maybe if we could see some of the code that you are using right now, it would be easier to help.

    /Kim A

     

  • Rich Green 2246 posts 4008 karma points
    Oct 26, 2010 @ 17:40
    Rich Green
    0

    Fredrik,

    You're going down the wrong route here.

    Have a read up on the "currentPage" variable, basically if you using XSLT the current page is almost like passing a parameter, it basically is a copy of the xml content relevant for the page you are on.

    You will only need ONE Product Category template, and ONE Product template (unless you want them to display differently of course).

    If you want to use a user control then you can access the current page by using (not tested, just guessing but you get the idea)

    umbraco.presentation.nodeFactory.GetCurrent()

    The way this works is each piece of content in Umbraco has a node ID, like:

    Products 

       Product Category 1 (nodeID 1001)

          Product 1 (nodeID 1002)

          Product 2 (nodeID 1011)

       Product Category 2 (nodeID 1005)

           etc..

    So when your user is on a particular 'Product' Umbraco will pass the relevant information for the 'Node' they are on.

    I would recommend you invest in Umbraco TV, if at least just for one month ($19) as it will give you a solid understanding.

    Rich

     

Please Sign in or register to post replies

Write your reply to:

Draft