jsblouet Posted February 16, 2015 Share Posted February 16, 2015 (edited) Hello there,I would like to display my CMS category or sub-category name into my URL. The goal is to have this kind of URL : www.mydomain.com/CATEGORY-NAME/page-url.html- orwww.mydomain.com/SUBCATEGORY-NAME/page-url.html Is somebody know the name of the parameter to put into the SEO parameter ? Or any way to achieved that ?See the image attached for more informations.Thanks to all by advance. js PRESTASHOP 1.6 Edited February 16, 2015 by jsblouet (see edit history) Link to comment Share on other sites More sharing options...
jsblouet Posted February 16, 2015 Author Share Posted February 16, 2015 Hi Crezzur, doesn't work the way I want : www.mydomain.com/{subCategories}/page-url.html > The browser display my page It seems that prestashop doesn't understand that {subCategories} is a parameter. Thanks for you answer Crezzur. Link to comment Share on other sites More sharing options...
designerfort Posted February 24, 2015 Share Posted February 24, 2015 i need this solution too Link to comment Share on other sites More sharing options...
designerfort Posted February 24, 2015 Share Posted February 24, 2015 I think it is linked with root folder classes/link.php /** * Create a link to a CMS category * * @param mixed $category CMSCategory object (can be an ID category, but deprecated) * @param string $alias * @param int $id_lang * @return string */ public function getCMSCategoryLink($cms_category, $alias = null, $id_lang = null, $id_shop = null) { if (!$id_lang) $id_lang = Context::getContext()->language->id; $url = $this->getBaseLink($id_shop).$this->getLangLink($id_lang, null, $id_shop); $dispatcher = Dispatcher::getInstance(); if (!is_object($cms_category)) { if ($alias !== null && !$dispatcher->hasKeyword('cms_category_rule', $id_lang, 'meta_keywords', $id_shop) && !$dispatcher->hasKeyword('cms_category_rule', $id_lang, 'meta_title', $id_shop)) return $url.$dispatcher->createUrl('cms_category_rule', $id_lang, array('id' => (int)$cms_category, 'rewrite' => (string)$alias), $this->allow, '', $id_shop); $cms_category = new CMSCategory($cms_category, $id_lang); } // Set available keywords $params = array(); $params['id'] = $cms_category->id; $params['rewrite'] = (!$alias) ? $cms_category->link_rewrite : $alias; $params['meta_keywords'] = Tools::str2url($cms_category->meta_keywords); $params['meta_title'] = Tools::str2url($cms_category->meta_title); return $url.$dispatcher->createUrl('cms_category_rule', $id_lang, $params, $this->allow, '', $id_shop); } /** * Create a link to a CMS page * * @param mixed $cms CMS object (can be an ID CMS, but deprecated) * @param string $alias * @param bool $ssl * @param int $id_lang * @return string */ public function getCMSLink($cms, $alias = null, $ssl = null, $id_lang = null, $id_shop = null) { if (!$id_lang) $id_lang = Context::getContext()->language->id; $url = $this->getBaseLink($id_shop, $ssl).$this->getLangLink($id_lang, null, $id_shop); $dispatcher = Dispatcher::getInstance(); if (!is_object($cms)) { if ($alias !== null && !$dispatcher->hasKeyword('cms_rule', $id_lang, 'meta_keywords', $id_shop) && !$dispatcher->hasKeyword('cms_rule', $id_lang, 'meta_title', $id_shop)) return $url.$dispatcher->createUrl('cms_rule', $id_lang, array('id' => (int)$cms, 'rewrite' => (string)$alias), $this->allow, '', $id_shop); $cms = new CMS($cms, $id_lang); } // Set available keywords $params = array(); $params['id'] = $cms->id; $params['rewrite'] = (!$alias) ? (is_array($cms->link_rewrite) ? $cms->link_rewrite[(int)$id_lang] : $cms->link_rewrite) : $alias; $params['meta_keywords'] = ''; if (isset($cms->meta_keywords) && !empty($cms->meta_keywords)) $params['meta_keywords'] = is_array($cms->meta_keywords) ? Tools::str2url($cms->meta_keywords[(int)$id_lang]) : Tools::str2url($cms->meta_keywords); $params['meta_title'] = ''; if (isset($cms->meta_title) && !empty($cms->meta_title)) $params['meta_title'] = is_array($cms->meta_title) ? Tools::str2url($cms->meta_title[(int)$id_lang]) : Tools::str2url($cms->meta_title); return $url.$dispatcher->createUrl('cms_rule', $id_lang, $params, $this->allow, '', $id_shop); } we will need to change statements and to define parameters for category or subcategory titles to be apear in urls Link to comment Share on other sites More sharing options...
PrestaTesters Posted March 1, 2016 Share Posted March 1, 2016 No help from me either because this is exactly what i'm looking for too domain.com/CATEGORY/page-url.html domain.com/CATEGORY/SUBCATEGORY/page-url.html 2 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now