Skip to content

Commit 01618fb

Browse files
author
tkostuch
committed
Merge remote-tracking branch '@vue-storefront/release/v1.12.0-rc.1' into release/v1.12.0
2 parents 42f9087 + c4254ff commit 01618fb

File tree

8 files changed

+800
-6
lines changed

8 files changed

+800
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
8383
- Move default theme to separate repository https://github.com/DivanteLtd/vsf-default - @gibkigonzo (#4255)
8484
- add two numbers after dot to price by default, calculate default price for bundle or grouped main product, update typing, add fallback to attribute options - @gibkigonzo (#4476)
8585
- udpate yarn and filter shipping methods for instant checkout - @gibkigonzo (#4480)
86+
- add attribute metadata search query, add parentId - @gibkigonzo (#4491)
8687

8788
## [1.11.4] - 2020.05.26
8889

core/lib/search/adapter/api-search-query/searchAdapter.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ export class SearchAdapter {
117117
start: start,
118118
perPage: size,
119119
aggregations: resp.aggregations,
120+
attributeMetadata: resp.attribute_metadata,
120121
suggestions: resp.suggest
121122
}
122123
} else {

core/modules/catalog/helpers/prepare/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import setDefaultQty from './setDefaultQty';
22
import setDefaultObjects from './setDefaultObjects';
33
import setParentSku from './setParentSku';
4+
import setParentId from './setParentId';
45
import setCustomAttributesForChild from './setCustomAttributesForChild';
56
import setDefaultProductOptions from './setDefaultProductOptions';
67

@@ -12,6 +13,7 @@ function preConfigureProduct (product) {
1213
setDefaultQty(product)
1314
setDefaultObjects(product)
1415
setParentSku(product)
16+
setParentId(product)
1517
setCustomAttributesForChild(product)
1618
setDefaultProductOptions(product)
1719

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import Product from '@vue-storefront/core/modules/catalog/types/Product';
2+
3+
/**
4+
* set parent id, this is needed, because in configuration process we will override id by configurable_children.id
5+
*/
6+
export default function setParentId (product: Product) {
7+
if (!product.parentId) {
8+
product.parentId = product.id
9+
}
10+
}

core/modules/catalog/store/product/getters.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,12 @@ const getters: GetterTree<ProductState, RootState> = {
77
getCurrentProduct: state => state.current,
88
getCurrentProductConfiguration: state => state.current_configuration,
99
getCurrentProductOptions: state => state.current_options,
10-
getOriginalProduct: state => {
11-
Logger.warn('`product/getOriginalProduct` deprecated, will be not used from 1.12')()
12-
return state.original
10+
getOriginalProduct: (state, getters) => {
11+
if (!getters.getCurrentProduct) return null
12+
return state.original || {
13+
...getters.getCurrentProduct,
14+
id: getters.getCurrentProduct.parentId || getters.getCurrentProduct.id
15+
}
1316
},
1417
getParentProduct: state => state.parent,
1518
getProductsSearchResult: state => state.list,

core/modules/catalog/types/Product.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ export default interface Product {
7171
_score?: number,
7272
qty?: number,
7373
tier_prices?: any[],
74-
links?: any
74+
links?: any,
75+
parentId?: number | string
7576
}
7677

7778
export interface ProductLink {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@
103103
"@babel/core": "^7.9.0",
104104
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
105105
"@babel/polyfill": "^7.8.3",
106-
"@babel/preset-env": "^7.8.6",
106+
"@babel/preset-env": "^7.9.0",
107107
"@types/jest": "^25.1.3",
108108
"@types/node": "^13.7.7",
109109
"@typescript-eslint/eslint-plugin": "^1.7.1-alpha.17",

yarn.lock

Lines changed: 777 additions & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)