<?php

$path = "../../";
require_once $path . 'core/includes/header.inc.php';

$order = new Order($_SESSION['order_id']);

$tracking_codes = [];
if ($order->getId()) {
    $tracking_codes[] = $twig->render('analytics_js.twig', [
        'order' => $order,
        'settings' => $GLOBALS['settings'],
    ]);
}

$page_meta = [
    'title' => 'Your order is now complete | ' . config('app.name'),
    'page_title' => 'Order Complete',
    'page_sub_title' => 'Thank you for shopping online with ' . config('app.name'),
];

$_SESSION['basket_id'] = '';
unset($basket);
$basket = new Basket();
$basket->Go_basket();

echo $twig->render('shop/checkout/order_complete.twig', [
    'page_html' => $_SESSION['basket_html'] ?? '',
    'basket_object' => $order,
    'page_meta' => $page_meta,
    'tracking_code' => $tracking_codes,
]);
