58 lines
1.7 KiB
PHP
Raw Normal View History

<?php
class Link extends LinkCore
{
public static $urls_products = array();
public static $urls_categories = array();
public static $urls_manufacturers = array();
public static $urls_cms = array();
2015-07-10 16:29:27 +02:00
// CMS
public static $urls_categories_cms = array();
2015-07-10 16:29:27 +02:00
public static $urls_posts_cms = array();
public function getCategoryCmsLink($id_category_cms, $id_lang = null, $id_shop = null,
$ipa = 0, $force_routes = false, $relative_protocol = false) {
if (!$id_lang)
$id_lang = Context::getContext()->language->id;
if (!$id_shop)
$id_shop = Context::getContext()->shop->id;
$url = $this->getBaseLink($id_shop, null, $relative_protocol).$this->getLangLink($id_lang, null, $id_shop);
if(!isset(self::$urls_categories_cms[$id_category_cms])) {
$link = ManageSeoUrl::getByType($id_category_cms, ManageSeoUrl::TYPE_CATEGORY_CMS, FALSE, $id_lang, $id_shop);
self::$urls_categories_cms[$id_category_cms] = $url.$link->link_rewrite;
return $url.$link->link_rewrite;
} else {
return self::$urls_categories_cms[$id_category_cms];
}
}
2015-07-10 16:29:27 +02:00
public function getPostCmsLink($id_post_cms, $id_lang = null, $id_shop = null,
$ipa = 0, $force_routes = false, $relative_protocol = false) {
if (!$id_lang)
$id_lang = Context::getContext()->language->id;
if (!$id_shop)
$id_shop = Context::getContext()->shop->id;
$url = $this->getBaseLink($id_shop, null, $relative_protocol).$this->getLangLink($id_lang, null, $id_shop);
if(!isset(self::$urls_posts_cms[$id_post_cms])) {
$link = ManageSeoUrl::getByType($id_post_cms, ManageSeoUrl::TYPE_POST_CMS, FALSE, $id_lang, $id_shop);
self::$urls_posts_cms[$id_post_cms] = $url.$link->link_rewrite;
return $url.$link->link_rewrite;
} else {
return self::$urls_posts_cms[$id_post_cms];
}
}
}