$isAjax = ( isset($_SERVER["HTTP_X_REQUESTED_WITH"]) && strtolower((string)$_SERVER["HTTP_X_REQUESTED_WITH"]) === "xmlhttprequest" && isset($_GET["control_ajax"]) && $_GET["control_ajax"] === "Y" ); if (!$isAjax && !empty($GLOBALS['__ASPRO_SCHEMA_CAT']) && is_array($GLOBALS['__ASPRO_SCHEMA_CAT'])) { $d = $GLOBALS['__ASPRO_SCHEMA_CAT']; // финальные SEO (SmartSEO уже успевает их выставить к футеру) $schemaName = trim((string)$APPLICATION->GetPageProperty('title')); if ($schemaName === '') { $schemaName = trim((string)$APPLICATION->GetTitle(false)); } if ($schemaName === '') { $schemaName = 'Каталог'; } $schemaDesc = trim((string)$APPLICATION->GetPageProperty('description')); $schema = [ "@context" => "https://schema.org", "@type" => "Product", "name" => $schemaName, "description" => $schemaDesc, "offers" => array_filter([ "@type" => "AggregateOffer", "offerCount" => (int)($d['offerCount'] ?? 0), "priceCurrency" => "RUB", "lowPrice" => $d['lowPrice'] ?? null, "highPrice" => $d['highPrice'] ?? null, ], static fn($v) => $v !== null && $v !== ''), ]; if (!empty($d['ratingValue']) && !empty($d['ratingCount'])) { $schema["aggregateRating"] = [ "@type" => "AggregateRating", "ratingValue" => (float)$d['ratingValue'], "bestRating" => 5, "worstRating" => 1, "ratingCount" => (int)$d['ratingCount'], "reviewCount" => (int)$d['ratingCount'], ]; } echo ''; }