How To: Мета-теги магазина как в HostCMS v.5

Изменения вносятся в код настроек типовой динамической страницы магазина со строки, начинающейся с $aTitle = array($oShop->name);:

Вариант 1

$aTitle = array();
$aDescription = array();
$aKeywords = array();

if ($Shop_Controller_Show->group)
{
    $oShop_Group = Core_Entity::factory('Shop_Group', $Shop_Controller_Show->group);

    $bGroupTitle = $oShop_Group->seo_title != '';
    $bGroupDescription = $oShop_Group->seo_description != '';
    $bGroupKeywords = $oShop_Group->seo_keywords != '';

    if (!$Shop_Controller_Show->item)
    {
        $bGroupTitle && Core_Page::instance()->title($oShop_Group->seo_title);
        $bGroupDescription && Core_Page::instance()->description($oShop_Group->seo_description);
        $bGroupKeywords && Core_Page::instance()->keywords($oShop_Group->seo_keywords);
    }

    do {
        ($Shop_Controller_Show->item || !$bGroupTitle) && array_unshift($aTitle, $oShop_Group->name);

        ($Shop_Controller_Show->item || !$bGroupDescription) && array_unshift($aDescription, $oShop_Group->name);

        ($Shop_Controller_Show->item || !$bGroupKeywords) && array_unshift($aKeywords, $oShop_Group->name);

    } while($oShop_Group = $oShop_Group->getParent());
}

if ($Shop_Controller_Show->item)
{
    $oShop_Item = Core_Entity::factory('Shop_Item', $Shop_Controller_Show->item);

    $oShop_Item->seo_title != ''
        ? Core_Page::instance()->title($oShop_Item->seo_title) && $aTitle = array()
        : $aTitle[] = $oShop_Item->name;

    $oShop_Item->seo_description != ''
        ? Core_Page::instance()->description($oShop_Item->seo_description) && $aDescription = array()
        : $aDescription[] = $oShop_Item->name;

    $oShop_Item->seo_keywords != ''
        ? Core_Page::instance()->keywords($oShop_Item->name) && $aKeywords = array()
        : $aKeywords[] = $oShop_Item->name;
}

Вариант 2:

 if ($Shop_Controller_Show->group)
{
   $oShop_Group = Core_Entity::factory('Shop_Group', $Shop_Controller_Show->group);

   Core_Page::instance()->title($oShop_Group->seo_title != ''
         ? $oShop_Group->seo_title
         : $oShop_Group->name);
   Core_Page::instance()->description($oShop_Group->seo_description != ''
         ? $oShop_Group->seo_description
         : $oShop_Group->name);
   Core_Page::instance()->keywords($oShop_Group->seo_keywords != ''
         ? $oShop_Group->seo_keywords
         : $oShop_Group->name);
}

if ($Shop_Controller_Show->item)
{
   $oShop_Item = Core_Entity::factory('Shop_Item', $Shop_Controller_Show->item);

   Core_Page::instance()->title($oShop_Item->seo_title != ''
         ? $oShop_Item->seo_title
         : $oShop_Item->name);
   Core_Page::instance()->description($oShop_Item->seo_description != ''
         ? $oShop_Item->seo_description
         : $oShop_Item->name);
   Core_Page::instance()->keywords($oShop_Item->seo_keywords != ''
         ? $oShop_Item->seo_keywords
         : $oShop_Item->name);
}

Core_Page::instance()->object = $Shop_Controller_Show;

Не нашли ответ на свой вопрос в документации? Направьте обращение в службу поддержки или онлайн чат.