getId(); if ($userId <= 0) { LocalRedirect(SITE_DIR . "login/?back=" . rawurlencode(Application::getInstance()->getContext()->getRequest()->getRequestUri())); } $request = Application::getInstance()->getContext()->getRequest(); $completed = (string)$request->getQuery("status") === "completed"; $page = max(1, min(50, (int)$request->getQuery("page"))); $result = Orders::forUser($userId, $completed, $page); $GLOBALS["APPLICATION"]->SetTitle(Loc::getMessage("VINO_ORD_PAGE_TITLE")); $GLOBALS["APPLICATION"]->SetPageProperty("description", Loc::getMessage("VINO_ORD_PAGE_DESCRIPTION")); $GLOBALS["APPLICATION"]->SetPageProperty("vino_alternates", "N"); $GLOBALS["APPLICATION"]->SetPageProperty("vino_schema", "N"); $GLOBALS["APPLICATION"]->SetPageProperty("robots", "noindex, nofollow"); $this->arResult = [ "COMPLETED" => $completed, "ORDERS" => $result["orders"], "MORE_URL" => $result["more"] ? SITE_DIR . "personal/orders/?" . ($completed ? "status=completed&" : "") . "page=" . ($page + 1) : "", "BASE_URL" => SITE_DIR . "personal/orders/", "CATALOG_URL" => SITE_DIR . "catalog/", ]; $this->includeComponentTemplate(); return $this->arResult; } }