Example #1
0
 public static function getProductMetas($id_product, $id_lang, $page_name)
 {
     $context = Context::getContext();
     $sql = 'SELECT `name`, `meta_title`, `meta_description`, `meta_keywords`, `description_short`
                         FROM `' . _DB_PREFIX_ . 'product` p
                         LEFT JOIN `' . _DB_PREFIX_ . 'product_lang` pl ON (pl.`id_product` = p.`id_product`' . Shop::addSqlRestrictionOnLang('pl') . ')
                         ' . Shop::addSqlAssociation('product', 'p') . '
                         WHERE pl.id_lang = ' . (int) $id_lang . '
                                 AND pl.id_product = ' . (int) $id_product . '
                                 AND product_shop.active = 1';
     if ($row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql)) {
         if ($context->language->id != 1) {
             $row['meta_title'] = Tools::rus2translit($row['meta_title']);
             $row['name'] = Tools::rus2translit($row['name']);
         }
         if (empty($row['meta_description'])) {
             $row['meta_description'] = strip_tags($row['description_short']);
         }
         return Meta::completeMetaTags($row, $row['name']);
     }
     return Meta::getHomeMetas($id_lang, $page_name);
 }
Example #2
0
 /**
  * @deprecated 1.5.0
  */
 public static function getHomeMetaTags($id_lang, $page_name)
 {
     Tools::displayAsDeprecated();
     return Meta::getHomeMetas($id_lang, $page_name);
 }
Example #3
0
    /**
     * Get CMS category meta tags
     *
     * @since 1.5.0
     * @param int $id_cms_category
     * @param int $id_lang
     * @param string $page_name
     * @return array
     */
    public static function getCmsCategoryMetas($id_cms_category, $id_lang, $page_name)
    {
        $sql = 'SELECT `meta_title`, `meta_description`, `meta_keywords`
				FROM `' . _DB_PREFIX_ . 'cms_category_lang`
				WHERE id_lang = ' . (int) $id_lang . '
					AND id_cms_category = ' . (int) $id_cms_category . ((int) Context::getContext()->shop->id ? ' AND id_shop = ' . (int) Context::getContext()->shop->id : '');
        if ($row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql)) {
            $row['meta_title'] = $row['meta_title'] . ' - ' . Configuration::get('PS_SHOP_NAME') . ' %city_name';
            $row = Meta::replaceCity($row);
            return Meta::completeMetaTags($row, $row['meta_title']);
        }
        return Meta::getHomeMetas($id_lang, $page_name);
    }
Example #4
0
    /**
     * Get CMS category meta tags
     *
     * @since 1.5.0
     * @param int $id_cms_category
     * @param int $id_lang
     * @param string $page_name
     * @return array
     */
    public static function getCmsCategoryMetas($id_cms_category, $id_lang, $page_name)
    {
        $sql = 'SELECT `meta_title`, `meta_description`, `meta_keywords`
				FROM `' . _DB_PREFIX_ . 'cms_category_lang`
				WHERE id_lang = ' . (int) $id_lang . '
					AND id_cms_category = ' . (int) $id_cms_category;
        if ($row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql)) {
            $row['meta_title'] = $row['meta_title'];
            return Meta::completeMetaTags($row, $row['meta_title']);
        }
        return Meta::getHomeMetas($id_lang, $page_name);
    }