Please post all pre-sales questions of all products on this forum

Bug in EShop Breadcrumbs – language not applied correctly

  • Christoph
  • Topic Author
  • Offline
  • New Member
  • New Member
More
16 hours 9 minutes ago - 16 hours 8 minutes ago #176427 by Christoph
Hi Giang,

I think I discovered a bug in the EShop component affecting breadcrumbs in multilingual sites. The issue occurs because the language parameter ($langCode) is not passed to the function EShopHelper::getCategoriesBreadcrumb().

I noticed that because I get breadcrumbs with a different language in the second sub category, because of a fallback to the site language (in my case German), so when I chose English I get a German entry after the first sub category in the breadcrumbs.Details:
  1. Category pages (/components/com_eshop/view/category/html.php - after comment "//Handle breadcrump")
    • The code originally did not pass $langCode so it fall back to German even when choosing English:
      $paths   = EShopHelper::getCategoriesBreadcrumb($category->id, $parentId);
    • To fix it, the function should be called like this:
      $langCode = Factory::getLanguage()->getTag();
      $paths = EShopHelper::getCategoriesBreadcrumb($category->id, $parentId, $langCode);
    • This ensures that all category names in the breadcrumb match the current site language.
  2. Product pages (view/product/html.php)
    • The same problem exists here. Originally, the code called:
      $paths = EShopHelper::getCategoriesBreadcrumb($categoryId, $parentId);
    • Since $langCode was missing, the breadcrumb always displayed the default language (usually German), even if the page was in English.
    • The fix is to pass the current language explicitly:
      $langCode = Factory::getLanguage()->getTag();
      $paths = EShopHelper::getCategoriesBreadcrumb($categoryId, $parentId, $langCode);
    • After this change, both the parent categories and the product’s direct category appear correctly in the current language.
I hope this helps.

Best regards,
Christoph
Last edit: 16 hours 8 minutes ago by Christoph.

Please Log in or Create an account to join the conversation.

Moderators: Tuan Pham NgocGiang Dinh TruongDang Thuc Dam