43 lines
1.7 KiB
PHP
43 lines
1.7 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
use Bitrix\Main\Context;
|
|
use Bitrix\Main\Localization\Loc;
|
|
use Jinove\Vinoteca\Cart;
|
|
|
|
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
|
|
die();
|
|
}
|
|
|
|
Loc::loadMessages(__FILE__);
|
|
|
|
class JinoveCartComponent extends CBitrixComponent
|
|
{
|
|
public function executeComponent(): array
|
|
{
|
|
global $APPLICATION;
|
|
$APPLICATION->SetTitle(Loc::getMessage("VINO_CART_PAGE_TITLE"));
|
|
$APPLICATION->SetPageProperty("title", Loc::getMessage("VINO_CART_BROWSER_TITLE"));
|
|
$APPLICATION->SetPageProperty("description", Loc::getMessage("VINO_CART_PAGE_DESCRIPTION"));
|
|
$APPLICATION->SetPageProperty("vino_alternates", "N");
|
|
$APPLICATION->SetPageProperty("vino_schema", "N");
|
|
$APPLICATION->SetPageProperty("robots", "noindex, nofollow");
|
|
$basket = Cart::load();
|
|
$shareCode = (string)Context::getCurrent()->getRequest()->getQuery("share");
|
|
$shareItems = $basket !== null && $shareCode !== "" ? Cart::parseShare($shareCode) : [];
|
|
$this->arResult = [
|
|
"TITLE" => (string)Loc::getMessage("VINO_CART_PAGE_TITLE"),
|
|
"SHARED" => $shareItems ? Cart::shared($shareItems) : null,
|
|
"SHARE_REQUESTED" => $shareCode !== "",
|
|
"CART_URL" => SITE_DIR . "personal/cart/",
|
|
"CART" => $basket !== null ? Cart::view($basket) : ["count" => 0, "summary" => "", "items" => [], "base" => "", "discount" => "", "total" => "", "coupons" => []],
|
|
"CATALOG_URL" => SITE_DIR . "catalog/",
|
|
"CHECKOUT_URL" => SITE_DIR . "personal/order/",
|
|
"MAX_QUANTITY" => Cart::MAX_QUANTITY,
|
|
];
|
|
$this->includeComponentTemplate();
|
|
|
|
return $this->arResult;
|
|
}
|
|
}
|