Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixed edit shipping address in my account - @gibkigonzo (#3921)
- Fetch cms_block content in serverPrefetch method - @gibkigonzo (#3910)
- Keep category products objects on ssr - @gibkigonzo (#3924)
- product breadcrumbs - check if current category is not highest one - @gibkigonzo (#3933)

### Changed / Improved
- Changed pre commit hook to use NODE_ENV production to check for debugger statements - @resubaka (#3686)
Expand Down
2 changes: 1 addition & 1 deletion core/modules/catalog-next/store/category/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ const actions: ActionTree<CategoryState, RootState> = {
},
async loadCategories ({ commit, getters }, categorySearchOptions: DataResolver.CategorySearchOptions): Promise<Category[]> {
const searchingByIds = !(!categorySearchOptions || !categorySearchOptions.filters || !categorySearchOptions.filters.id)
const searchedIds: string[] = searchingByIds ? ([...categorySearchOptions.filters.id] as string[]) : []
const searchedIds: string[] = searchingByIds ? [...categorySearchOptions.filters.id].map(String) : []
const loadedCategories: Category[] = []
if (searchingByIds && !categorySearchOptions.reloadAll) { // removing from search query already loaded categories, they are added to returned results
for (const [categoryId, category] of Object.entries(getters.getCategoriesMap)) {
Expand Down
6 changes: 5 additions & 1 deletion core/modules/catalog/store/product/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,11 @@ const actions: ActionTree<ProductState, RootState> = {
let breadcrumbCategory
const categoryFilters = Object.assign({ 'id': [...product.category_ids] }, cloneDeep(config.entities.category.breadcrumbFilterFields))
const categories = await dispatch('category-next/loadCategories', { filters: categoryFilters, reloadAll: Object.keys(config.entities.category.breadcrumbFilterFields).length > 0 }, { root: true })
if (currentCategory && currentCategory.id && (categories.findIndex(category => category.id === currentCategory.id) >= 0)) {
if (
(currentCategory && currentCategory.id) && // current category exist
(config.entities.category.categoriesRootCategorylId !== currentCategory.id) && // is not highest category (All) - if we open product from different page then category page
(categories.findIndex(category => category.id === currentCategory.id) >= 0) // can be found in fetched categories
) {
breadcrumbCategory = currentCategory // use current category if set and included in the filtered list
} else {
breadcrumbCategory = categories.sort((a, b) => (a.level > b.level) ? -1 : 1)[0] // sort starting by deepest level
Expand Down