SetTitle($title); $APPLICATION->SetPageProperty("title", (string)Loc::getMessage("VINO_ABOUT_BROWSER_TITLE")); $APPLICATION->SetPageProperty("description", (string)Loc::getMessage("VINO_ABOUT_DESCRIPTION")); $contacts = Config::contacts(); $counts = $this->counts(); $this->arResult = [ "TITLE" => $title, "WINES" => $counts["wines"], "BRANDS" => $counts["brands"], "TYPES" => $counts["types"], "PHONE" => (string)($contacts["phone"] ?? ""), "PHONE_LABEL" => (string)($contacts["phoneLabel"] ?? ""), "EMAIL" => (string)($contacts["email"] ?? ""), "MAP_URL" => "https://yandex.ru/maps/?text=" . rawurlencode(self::MAP_ADDRESS), "CATALOG_URL" => SITE_DIR . "catalog/", "BRANDS_URL" => SITE_DIR . "brands/", "DESCRIPTION" => (string)Loc::getMessage("VINO_ABOUT_DESCRIPTION"), "SCHEMA" => PageSchema::aboutPage(SITE_DIR . "about/", $title, (string)Loc::getMessage("VINO_ABOUT_DESCRIPTION"), PageSchema::image(Config::host() . SITE_DIR . "about/#image", Config::host() . SITE_TEMPLATE_PATH . "/assets/media/about-intro-1400.webp", 1400, 933)), "MAP" => ["LAT" => self::MAP_LAT, "LON" => self::MAP_LON, "ZOOM" => self::MAP_ZOOM, "STYLE" => SITE_TEMPLATE_PATH . "/assets/map/vinoteca-dark.json"], ]; $this->includeComponentTemplate(); return $this->arResult; } private function counts(): array { $cache = Cache::createInstance(); if ($cache->initCache(self::CACHE_TTL, "counts-" . LANGUAGE_ID, self::CACHE_DIR)) { return (array)$cache->getVars(); } $cache->startDataCache(); $taggedCache = Application::getInstance()->getTaggedCache(); $taggedCache->startTagCache(self::CACHE_DIR); try { $brandsId = Config::iblockId("brands"); $taggedCache->registerTag("iblock_id_" . Config::iblockId("catalog")); $taggedCache->registerTag("iblock_id_" . $brandsId); $counts = [ "wines" => ServiceLocator::getInstance()->get("jinove.vinoteca.wineStats")->getActiveCount(), "brands" => Loader::includeModule("iblock") ? ElementTable::getCount(["=IBLOCK_ID" => $brandsId, "=ACTIVE" => "Y"]) : 0, "types" => MegaMenu::types(Config::iblockId("catalog")), ]; } catch (\Throwable $e) { $taggedCache->abortTagCache(); $cache->abortDataCache(); return ["wines" => 0, "brands" => 0, "types" => []]; } $taggedCache->endTagCache(); $cache->endDataCache($counts); return $counts; } }