40 lines
1.5 KiB
PHP
40 lines
1.5 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
use Bitrix\Main\Localization\Loc;
|
|
use Jinove\Vinoteca\Cart;
|
|
use Jinove\Vinoteca\Checkout;
|
|
|
|
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
|
|
die();
|
|
}
|
|
|
|
Loc::loadMessages(__FILE__);
|
|
|
|
class JinoveOrderComponent extends CBitrixComponent
|
|
{
|
|
public function executeComponent(): array
|
|
{
|
|
global $APPLICATION;
|
|
$APPLICATION->SetTitle(Loc::getMessage("VINO_ORDER_PAGE_TITLE"));
|
|
$APPLICATION->SetPageProperty("title", Loc::getMessage("VINO_ORDER_BROWSER_TITLE"));
|
|
$APPLICATION->SetPageProperty("description", Loc::getMessage("VINO_ORDER_PAGE_DESCRIPTION"));
|
|
$APPLICATION->SetPageProperty("vino_alternates", "N");
|
|
$APPLICATION->SetPageProperty("vino_schema", "N");
|
|
$APPLICATION->SetPageProperty("robots", "noindex, nofollow");
|
|
Loc::loadMessages($_SERVER["DOCUMENT_ROOT"] . SITE_TEMPLATE_PATH . "/footer.php");
|
|
$basket = Cart::load();
|
|
$cart = $basket !== null ? Cart::view($basket) : null;
|
|
$this->arResult = [
|
|
"TITLE" => (string)Loc::getMessage("VINO_ORDER_PAGE_TITLE"),
|
|
"CART" => $cart !== null && array_filter($cart["items"], static fn(array $item): bool => $item["available"]) ? $cart : null,
|
|
"METHODS" => Checkout::methods(),
|
|
"CART_URL" => SITE_DIR . "personal/cart/",
|
|
"CATALOG_URL" => SITE_DIR . "catalog/",
|
|
];
|
|
$this->includeComponentTemplate();
|
|
|
|
return $this->arResult;
|
|
}
|
|
}
|