Skip to content

Commit 4504fe4

Browse files
author
Tomasz Kostuch
authored
Merge pull request #4459 from gibkigonzo/bugfix/refactor-mappingFallback
refactor mapping fallback - use transform url functions
2 parents 126c559 + 18bb528 commit 4504fe4

File tree

2 files changed

+3
-16
lines changed

2 files changed

+3
-16
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7777
- Include token in pricing sync - @carlokok (#4156)
7878
- Move 'graphql' search adapter from core to src (deprecated) - @gibkigonzo (#4214)
7979
- Homepage, new products query, uses now `new` attribute - @mdanilwoicz
80-
- Refactor product module, more info in upgrade notes- @gibkigonzo (#3952)
80+
- Refactor product module, more info in upgrade notes- @gibkigonzo (#3952, #4459)
8181

8282
## [1.11.3] - 2020.04.27
8383

core/modules/url/store/actions.ts

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -85,30 +85,17 @@ export const actions: ActionTree<UrlState, any> = {
8585
Deprecated action mappingFallback - use mapFallbackUrl instead.
8686
You can enable mapFallbackUrl by changing 'config.urlModule.enableMapFallbackUrl' to true
8787
`)()
88-
const { storeCode, appendStoreCode } = currentStoreView()
8988
const productQuery = new SearchQuery()
9089
url = (removeStoreCodeFromRoute(url.startsWith('/') ? url.slice(1) : url) as string)
9190
productQuery.applyFilter({ key: 'url_path', value: { 'eq': url } }) // Tees category
9291
const products = await dispatch('product/list', { query: productQuery }, { root: true })
9392
if (products && products.items && products.items.length) {
9493
const product = products.items[0]
95-
return {
96-
name: localizedDispatcherRouteName(product.type_id + '-product', storeCode, appendStoreCode),
97-
params: {
98-
slug: product.slug,
99-
parentSku: product.sku,
100-
childSku: params['childSku'] ? params['childSku'] : product.sku
101-
}
102-
}
94+
return transformProductUrl(product, params)
10395
} else {
10496
const category = await dispatch('category/single', { key: 'url_path', value: url }, { root: true })
10597
if (category !== null) {
106-
return {
107-
name: localizedDispatcherRouteName('category', storeCode, appendStoreCode),
108-
params: {
109-
slug: category.slug
110-
}
111-
}
98+
return transformCategoryUrl(category)
11299
}
113100
}
114101
},

0 commit comments

Comments
 (0)