Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update CatalogBreadcrumbTrait.php #3192

Merged
merged 1 commit into from
Apr 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions core/lib/Thelia/Model/Breadcrumb/CatalogBreadcrumbTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

trait CatalogBreadcrumbTrait
{
public function getBaseBreadcrumb(Router $router, $categoryId)
public function getBaseBreadcrumb(Router $router, $categoryId, $locale)
{
$translator = Translator::getInstance();
$catalogUrl = $router->generate('admin.catalog', [], Router::ABSOLUTE_URL);
Expand All @@ -42,7 +42,7 @@ public function getBaseBreadcrumb(Router $router, $categoryId)
if ($category != null) {
$results[] = [
'ID' => $category->getId(),
'TITLE' => $category->getTitle(),
'TITLE' => $category->setLocale($locale)->getTitle(),
'URL' => $category->getUrl(),
];

Expand All @@ -53,7 +53,7 @@ public function getBaseBreadcrumb(Router $router, $categoryId)
if (\in_array($currentId, $ids)) {
throw new \LogicException(
sprintf(
'Circular reference detected in folder ID=%d hierarchy (folder ID=%d appears more than one times in path)',
'Circular reference detected in category ID=%d hierarchy (category ID=%d appears more than one times in path)',
$categoryId,
$currentId
)
Expand Down Expand Up @@ -81,7 +81,7 @@ public function getProductBreadcrumb(Router $router, $tab, $locale)
/** @var \Thelia\Model\Product $product */
$product = $this->getProduct();

$breadcrumb = $this->getBaseBreadcrumb($router, $product->getDefaultCategoryId());
$breadcrumb = $this->getBaseBreadcrumb($router, $product->getDefaultCategoryId(), $locale);

$product->setLocale($locale);

Expand All @@ -103,7 +103,7 @@ public function getCategoryBreadcrumb(Router $router, $tab, $locale)

/** @var \Thelia\Model\Category $category */
$category = $this->getCategory();
$breadcrumb = $this->getBaseBreadcrumb($router, $this->getParentId());
$breadcrumb = $this->getBaseBreadcrumb($router, $this->getParentId(), $locale);

$category->setLocale($locale);

Expand Down