We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 13461
    • 2 Posts
    I am fairly new to MODx and this is my first post on the forums. I am not a PHP developer so please be gentle but am used to using HTML/CSS/JS etc for front-end web design. I am helping a friend with a website and we have reached a problem. Any help greatly appreciated as you will be saving a lot of hair pulling smiley

    The website in question has several divisions. Each division has a list of product links. Once clicked they need to load the same product document but load a different paragraph of text (from a template variable or child document) to be loaded depending on which division page they arrived from.


    Example document tree

    - Division 1
    • Choose Products
    - Division 2
    • Choose Products
    - Division 3
    • Choose Products
    - Division 4
    • Choose Products
    - Division 5
    • Choose Products
    - Division 6
    • Choose Products
    - Division 7
    • Choose Products
    - Division 8
    • Choose Products

    - Products
    - Product page
    • Division 1 description
    • Division 2 description
    • Division 3 description
    • Division 4 description
    • Division 5 description
    • Division 6 description
    • Division 7 description
    • Division 8 description
    • General description (this is in case someone gets to the page direct from a search engine or direct link)
    + Product page
    + Product page
    + Product page
    + Product page
    + Product page

    (Every product would have 9 descriptions - one for each division and a general description)

    My other thought is that descriptions could be in template variables rather than child documents.


    Example of what I need to achieve
    if previous page is <list of doc ids>
    display division 1 description child document or template variable (possibly using GetField)
    elseif previous page is <list of doc ids>
    display division 2 description
    elseif previous page is <list of doc ids>
    display division 3 description
    elseif previous page is <list of doc ids>
    display division 4 description
    elseif previous page is <list of doc ids>
    display division 5 description
    elseif previous page is <list of doc ids>
    display division 6 description
    elseif previous page is <list of doc ids>
    display division 7 description
    elseif previous page is <list of doc ids>
    display division 8 description
    else
    display general description

    Is this something that can be achieved with Phx with GetField? If not could the moderator please direct this topic to the correct board.

    Has anyone done anything similar or have any suggestions on how to achieve this another way. If anyone has a working example or something to get me started it would be much appreciated.