Skip to content

Commit

Permalink
Merge pull request #2168 from pkarw/develop
Browse files Browse the repository at this point in the history
Fix with the `productLinks` for Related.vue
  • Loading branch information
pkarw authored Jan 11, 2019
2 parents 87c8df9 + 011cd82 commit 4da8bcf
Showing 1 changed file with 23 additions and 25 deletions.
48 changes: 23 additions & 25 deletions src/themes/default/components/core/blocks/Product/Related.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,33 +60,31 @@ export default {
},
methods: {
refreshList () {
if (this.productLinks) {
let sku = this.productLinks
.filter(pl => pl.link_type === this.type)
.map(pl => pl.linked_product_sku)
let sku = this.productLinks ? this.productLinks
.filter(pl => pl.link_type === this.type)
.map(pl => pl.linked_product_sku) : null
let key = 'sku'
if (!(sku.length > 0)) {
sku = this.product.current.category.map(cat => cat.category_id)
key = 'category_ids'
}
let relatedProductsQuery = prepareRelatedQuery(key, sku)
this.$store.dispatch('product/list', {
query: relatedProductsQuery,
size: 8,
prefetchGroupProducts: false,
updateState: false
}).then((response) => {
if (response) {
this.$store.dispatch('product/related', {
key: this.type,
items: response.items
})
this.$forceUpdate()
}
})
let key = 'sku'
if (!(sku.length > 0)) {
sku = this.product.current.category.map(cat => cat.category_id)
key = 'category_ids'
}
let relatedProductsQuery = prepareRelatedQuery(key, sku)
this.$store.dispatch('product/list', {
query: relatedProductsQuery,
size: 8,
prefetchGroupProducts: false,
updateState: false
}).then((response) => {
if (response) {
this.$store.dispatch('product/related', {
key: this.type,
items: response.items
})
this.$forceUpdate()
}
})
}
},
computed: {
Expand Down

0 comments on commit 4da8bcf

Please sign in to comment.