Skip to content

Commit

Permalink
Fix to #2709
Browse files Browse the repository at this point in the history
  • Loading branch information
pkarw committed Apr 13, 2019
1 parent b9141d3 commit e7b83c0
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/themes/default/components/core/ProductGalleryCarousel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@
import store from '@vue-storefront/core/store'
import { Carousel, Slide } from 'vue-carousel'
import ProductVideo from './ProductVideo'
import reduce from 'lodash-es/reduce'
import map from 'lodash-es/map'
export default {
name: 'ProductGalleryCarousel',
Expand Down Expand Up @@ -150,14 +152,13 @@ export default {
},
selectVariant () {
if (store.state.config.products.gallery.mergeConfigurableChildren) {
let configurableAttributes = this.configuration.map(option => option.attribute_code)
let option = configurableAttributes.reduce((result, attribute) => {
const option = reduce(map(this.configuration, 'attribute_code'), (result, attribute) => {
result[attribute] = this.configuration[attribute].id
return result
}, {})
if (option) {
let index = this.gallery.findIndex(
obj => obj.id && Object.entries(obj.id).toSTring() === Object.entries(option).toString(), option)
const index = this.gallery.findIndex(
obj => obj.id && Object.entries(obj.id).toString() === Object.entries(option).toString(), option)
this.navigate(index)
}
}
Expand Down

0 comments on commit e7b83c0

Please sign in to comment.