php js css php js css

Scripts

Save Script Run
Attached Artifacts
Title
PHP Code
<?php $out = ['examples' => [], 'courses' => [], 'contacts' => []]; foreach (\Components\AF\Courses::getAll(['order' => [['course_id', 'desc']], 'limit' => 20]) as $course) $out['examples'][] = ['id' => $course['course_id'], 'code' => $course['course_code'], 'type' => $course['course_type']]; foreach ([376,377,378] as $id) { $course = \Components\AF\Courses::get($id); $out['courses'][] = ['id' => $id, 'code' => $course['course_code'], 'type' => $course['course_type'], 'product_id' => $course['product_id'] ?? null, 'product_title' => $course['product_id'] ? \Components\Commerce\Products::getColumn($course['product_id'], 'product_title') : null]; } foreach ([1393,1394,1395,1396,1397,1398] as $id) { $contact = \Components\Customers\Contacts::get($id); $out['contacts'][] = ['id' => $id, 'first' => $contact['contact_first_name'], 'last' => $contact['contact_last_name'], 'email' => $contact['contact_email']]; } echo json_encode($out, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);

Run Log

▼ Today 4:33am ✓ Completed 0.1s
{
    "examples": [
        {
            "id": "378",
            "code": "PRESENTATION-20261008-PRIVATE-ALEX",
            "type": "private"
        },
        {
            "id": "377",
            "code": "PRESENTATION-20261008-A1-WED",
            "type": "collective"
        },
        {
            "id": "376",
            "code": "PRESENTATION-20261008-A1-FRI",
            "type": "collective"
        },
        {
            "id": "375",
            "code": "Conversation A2-Wed-20270419-50",
            "type": "collective"
        },
        {
            "id": "374",
            "code": "A1 Intensive-Mon-20270201-49",
            "type": "collective"
        },
        {
            "id": "373",
            "code": "A1.1 Corporate-Tue-20271004-48",
            "type": "collective"
        },
        {
            "id": "372",
            "code": "Pre-School-Sat-20270712-47",
            "type": "collective"
        },
        {
            "id": "371",
            "code": "Pre-School-Fri-20270419-46",
            "type": "collective"
        },
        {
            "id": "370",
            "code": "Pre-School-Sat-20270201-45",
            "type": "collective"
        },
        {
            "id": "369",
            "code": "Pre-School-Fri-20271004-44",
            "type": "collective"
        },
        {
            "id": "368",
            "code": "Kids Conversation B1-Wed-20270712-43",
            "type": "collective"
        },
        {
            "id": "367",
            "code": "Kids Holiday Immersion A2-Tue-20270419-42",
            "type": "collective"
        },
        {
            "id": "366",
            "code": "Kids Holiday Immersion A1-Tue-20270201-41",
            "type": "collective"
        },
        {
            "id": "365",
            "code": "Taste of French Kids 2-Sat-20271004-40",
            "type": "collective"
        },
        {
            "id": "364",
            "code": "Taste of French Kids 1-Sat-20270712-39",
            "type": "collective"
        },
        {
            "id": "363",
            "code": "Year 3-Sat-20270419-38",
            "type": "collective"
        },
        {
            "id": "362",
            "code": "Year 2-Sat-20270201-37",
            "type": "collective"
        },
        {
            "id": "361",
            "code": "Year 1-Sat-20271004-36",
            "type": "collective"
        },
        {
            "id": "360",
            "code": "Prep-Sat-20270712-35",
            "type": "collective"
        },
        {
            "id": "359",
            "code": "Taste of French Y11-Thu-20270419-34",
            "type": "collective"
        }
    ],
    "courses": [
        {
            "id": 376,
            "code": "PRESENTATION-20261008-A1-FRI",
            "type": "collective",
            "product_id": "513",
            "product_title": "French for Beginners - Presentation Demo"
        },
        {
            "id": 377,
            "code": "PRESENTATION-20261008-A1-WED",
            "type": "collective",
            "product_id": "514",
            "product_title": "French for Beginners - Presentation Demo"
        },
        {
            "id": 378,
            "code": "PRESENTATION-20261008-PRIVATE-ALEX",
            "type": "private",
            "product_id": null,
            "product_title": null
        }
    ],
    "contacts": [
        {
            "id": 1393,
            "first": "Camille",
            "last": "Presentation Demo",
            "email": "af-presentation-camille@example.invalid"
        },
        {
            "id": 1394,
            "first": "Alex",
            "last": "Presentation Demo",
            "email": "af-presentation-alex@example.invalid"
        },
        {
            "id": 1395,
            "first": "Sophie",
            "last": "Presentation Demo",
            "email": "af-presentation-sophie@example.invalid"
        },
        {
            "id": 1396,
            "first": "Jordan",
            "last": "Presentation Demo",
            "email": "af-presentation-jordan@example.invalid"
        },
        {
            "id": 1397,
            "first": "Morgan",
            "last": "Presentation Demo",
            "email": "af-presentation-morgan@example.invalid"
        },
        {
            "id": 1398,
            "first": "Robin",
            "last": "Salaried - Presentation Demo",
            "email": "af-presentation-robin@example.invalid"
        }
    ]
}