Vinoteca: wine shop on 1C-Bitrix (module, template, components, pages)

This commit is contained in:
jimagie committed 2026-10-22 23:22:27 +05:00
commit 52795535ae
586 files changed
+27619

No files matched your search

@@ -0,0 +1,43 @@
<?php
declare(strict_types=1);
use Bitrix\Main\Application;
use Bitrix\Main\Engine\CurrentUser;
use Bitrix\Main\Localization\Loc;
use Jinove\Vinoteca\Personal\Orders;
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die();
}
Loc::loadMessages(__FILE__);
class JinovePersonalOrdersComponent extends CBitrixComponent
{
public function executeComponent(): array
{
$userId = (int)CurrentUser::get()->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;
}
}