Skip to content

Instantly share code, notes, and snippets.

@if0rest
Last active April 5, 2021 11:31
Show Gist options
  • Save if0rest/94336657712f8705057d53ec6e128115 to your computer and use it in GitHub Desktop.
Save if0rest/94336657712f8705057d53ec6e128115 to your computer and use it in GitHub Desktop.
Set the page's number for metatag in Bitrix
<?
AddEventHandler('main', 'OnEpilog', array('CMainHandlers', 'OnEpilogHandler'));
class CMainHandlers
{
public static function OnEpilogHandler()
{
global $APPLICATION;
if (isset($_GET['PAGEN_1']) && intval($_GET['PAGEN_1']) > 0)
{
$pageNum = $_GET['PAGEN_1'];
switch ($APPLICATION->GetCurDir()) {
case '/catalog/':
$APPLICATION->SetPageProperty('title', "Одежда для детей и подростков 0 до 14 лет | Каталог: Страница {$pageNum}");
$APPLICATION->SetPageProperty('description', "В каталоге представлены модели для детей и подростков от 0 до 14 лет. Каталог: Страница {$pageNum}.");
break;
case '/catalog/bluzy_i_rubashki/':
case '/catalog/bryuki_i_polukombinezony/':
case '/catalog/yubki_i_shorty/':
$APPLICATION->SetPageProperty('title', $APPLICATION->GetTitle()." для девочек | Каталог: Страница {$pageNum}");
$APPLICATION->SetPageProperty('description', "Интернет-магазин представляет лимитированную коллекцию одежды: ".ToLower($APPLICATION->GetTitle())." для девочек по доступным ценам! Доставка по всей России.");
break;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment