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

    I have just started down the MODX track after taking on supporting a website for a friend, and am working on some small amendments for them.

    My first one is to create a simple listing of locations and dates for some courses that they run. e.g.
    A simple wireframe of what I would like to show (the dates being a clickable url direct to first step of the booking process)

    +-----------------------------------------+-----------------+
    |Course 1 | Location 1 |
    | details of course - manually entered | 11 Jan |
    | | 15 Feb Reval |
    | | Location 2 |
    | | 21 Jan |
    | | 19 Feb |
    | | 05 Mar |
    +-----------------------------------------+-----------------+
    |Course 2 | Location 1 |
    | details of course - manually entered | 12 Jan |
    | | 16 Feb |
    | | Location 2 |
    | | 22 Jan |
    | | 20 Feb |
    | | 06 Mar |
    +-----------------------------------------+-----------------+

    The Courses have been entered as resources, and the locations and sessions are in custom tables.
    Web
    - Home (1)
    - Courses (2)
    - Course 1 (3)
    - Course 2 (14)

    The Venue table is id, venue_name, address, suburb, state, postcode
    The Session table is id, course_id, venue_id, course_type, begin_date, end_date

    When I run the following query, I can get all the details I would like to show, and the details needed for the url

    SELECT v.id AS venue_id, v.venue_name, s.id AS session_id, s.`course_type` , FROM_UNIXTIME( s.begin_date ) AS begin_date
    FROM maritime_course_session s
    LEFT JOIN maritime_course_venue v ON s.venue_id = v.id
    WHERE s.course_id =3
    AND s.begin_date > UNIX_TIMESTAMP( )
    LIMIT 0 , 30

    venue_id venue_name session_id course_type begin_date
    5 Manly, Brisbane 132 Standard 16/02/2014
    5 Manly, Brisbane 133 Revalidation 18/05/2014
    8 Mosman, Sydney 135 Standard 9/03/2014
    8 Mosman, Sydney 136 Standard 27/04/2014
    8 Mosman, Sydney 137 Standard 15/06/2014

    I would like the url to be built using the courseid, venue_id and session_id
    e.g. /step2.html?courseId=3&venueId=5&sessionId=132

    Is it best to use a snippet or some custom php code?

    I am currently on MODX 2.2.4-pl, and have getResources, FormIt, and Wayfinder installed.

    Please let me know if you require any further information, or if this is the wrong place to submit queries like this.
    Thanks in advance.

      • 28042 ☆ A M B ☆
      • 24,524 Posts
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org