Jump to content

[SOLVED] altering $path in breadcrumb


zwacklmann

Recommended Posts

I'll use the product page breadcrumb as an example. The path variable is created on line 196 of product.php (in PrestaShop v1.3.5):

'path' => ((isset($category->id) AND $category->id) ? Tools::getFullPath(intval($category->id), $product->name) : Tools::getFullPath(intval($product->id_category_default), $product->name))



Which uses the Tools::getFullPath to create the path:

static public function getFullPath($id_category, $end)
{
   global $cookie;

   $pipe = (Configuration::get('PS_NAVIGATION_PIPE') ? Configuration::get('PS_NAVIGATION_PIPE') : '>');
   $category = new Category(intval($id_category), intval($cookie->id_lang));
   if (!Validate::isLoadedObject($category))
       die(self::displayError());
   if ($id_category == 1)
       return htmlentities($end, ENT_NOQUOTES, 'UTF-8');
   return self::getPath($id_category, Category::hideCategoryPosition($category->name), true).''.$pipe.' '.htmlentities($end, ENT_NOQUOTES, 'UTF-8').'';
}

Link to comment
Share on other sites

  • 10 months later...
  • 2 months later...

I am looking for removing the product name from the breadcrumb, leaving just the home-category-subcategory, as the prooduct name is mentioned already right below the breadcrumb. Now if I change the

 

'path' => Tools::getPath((int)$category->id, $this->product->name, true),

 

into

 

'path' => Tools::getPath((int)$category->id, true),

 

 

it leaves just '1' for product name. Anyone knows how to remove?

Link to comment
Share on other sites

  • 3 weeks later...

I am looking for removing the product name from the breadcrumb, leaving just the home-category-subcategory, as the prooduct name is mentioned already right below the breadcrumb. Now if I change the

 

'path' => Tools::getPath((int)$category->id, $this->product->name, true),

 

into

 

'path' => Tools::getPath((int)$category->id, true),

 

 

it leaves just '1' for product name. Anyone knows how to remove?

You need change the line 884 in Classes/Tools.php

return $fullPath.$path;

To:

return $fullPath;

 

Anyone know how move the breadcrumb below top hook?, like the attached image

post-286411-0-09615600-1328591199_thumb.jpg

Link to comment
Share on other sites

  • 1 year later...
  • 5 years later...

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...