Jump to content

All path in url Products


jass82

Recommended Posts

Hi friend,

I read alls post on https://www.prestashop.com/forums/topic/220017-category-subcategory-url/ and i make the changes in dispatcher.php and link.php and work fine.

But i want the same in product page   mydomain.com/maincategory/subcategory/product

I'm modiffy in link.php getProductLink and i think i have to modify this part

 if ($dispatcher->hasKeyword('product_rule', $id_lang, 'categories', $id_shop)) {
            $params['category'] = (!$category) ? $product->category : $category;
            $cats = array();
            foreach ($product->getParentCategories($id_lang) as $cat) {
                if (!in_array($cat['id_category'], Link::$category_disable_rewrite)) {
                    //remove root and home category from the URL
                    $cats[] = $cat['link_rewrite'];
                }
            }
            $params['categories'] = implode('/', $cats);
        }
 
--------
but i put this and dont work,.... 
 
        $cats = array();
        foreach ($category->getParentsCategories() as $cat)
            if (!in_array($cat['id_category'], array(1, 2, $category->id)))//remove root, home and current category from the URL
              $cats[] = $cat['link_rewrite'];
              
        $params['categories'] = implode('/', array_reverse($cats));
 

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...