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

This commit is contained in:
jimagie committed 2026-10-22 19:35:23 +05:00
commit 0590195880
593 files changed
+27942

No files matched your search

@@ -0,0 +1,40 @@
<?php
use Bitrix\Main\Application;
use Jinove\Vinoteca\Catalog\MegaMenu;
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die();
}
class JinoveCatalogMegaMenuComponent extends CBitrixComponent
{
public function onPrepareComponentParams($params): array
{
$params["IBLOCK_ID"] = (int)($params["IBLOCK_ID"] ?? 0);
$params["BRANDS_LIMIT"] = max(1, (int)($params["BRANDS_LIMIT"] ?? 10));
$params["CACHE_TIME"] = (int)($params["CACHE_TIME"] ?? 86400);
return $params;
}
public function executeComponent(): void
{
if ($this->arParams["IBLOCK_ID"] <= 0) {
return;
}
if ($this->startResultCache()) {
$this->arResult = MegaMenu::collect($this->arParams["IBLOCK_ID"], $this->arParams["BRANDS_LIMIT"]);
$taggedCache = Application::getInstance()->getTaggedCache();
foreach (MegaMenu::tags($this->arParams["IBLOCK_ID"]) as $tag) {
$taggedCache->registerTag($tag);
}
if (empty($this->arResult["TYPES"])) {
$this->abortResultCache();
return;
}
$this->includeComponentTemplate();
}
}
}