Skip to content

Commit

Permalink
Merge branch 'develop' into bugfix/#2409-check-for-multiple-order-pla…
Browse files Browse the repository at this point in the history
…cing
  • Loading branch information
patzick committed Feb 26, 2019
2 parents 6aac8c6 + 5863faf commit f47057a
Show file tree
Hide file tree
Showing 14 changed files with 56 additions and 16 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added clear filters button on desktop also and only show if filters are applied - @DaanKouters (#2342)
- Improved docs at contributing.md and configuration.md (spelling etc.) - @ruthgeridema (#2421, #2422, #2423, #2425, #2426)
- Fixed design issue of Country label on Edge 17 & Firefox - @ananth-iyer (#2390,#2399)
- Wishlist and compare items are loaded from local cache only once, instead of every time when module component is rendered - @patzick (#2431)
- Country field is filled by first counry from the list in cart in paymen section - @RakowskiPrzemyslaw (#2428)
- Added video support in Product Gallery component. - @rain2o (#2433)
- Improved product quantity change component in product and cart - @patzick (#2398, #2437)
Expand All @@ -29,6 +30,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- add cart count config, allows you to display the item count instead of a sum of the item quantities - @pauluse (#2483)
- improved product gallery load view, shows correct image on reload - @patzick (#2481, #2482, #2488, #2501)
- Fix an issue where the index.html template within a theme is ignored - @EnthrallRecords (#2489)
- Inconsistent filters behaviour - clear filters on page load - @patzick (#2435)
- fix price is never below 0 and user can't add 0 or below 0 products to cart @RakowskiPrzemyslaw (#2437)
- Check for placing single order in case of error in any payment module - @patzick (#2409)

Expand Down
3 changes: 3 additions & 0 deletions core/compatibility/components/blocks/Category/Sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ export default {
return Object.keys(this.activeFilters).length !== 0
}
},
mounted () {
this.resetAllFilters()
},
methods: {
sortById (filters) {
return [...filters].sort((a, b) => { return a.id - b.id })
Expand Down
5 changes: 3 additions & 2 deletions core/modules/compare/store/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ import CompareState from '../types/CompareState'
import { cacheStorage } from '../'
import { Logger } from '@vue-storefront/core/lib/logger'
const actions: ActionTree<CompareState, RootState> = {
load (context) {
const commit = context.commit
load ({ commit, getters }, force: boolean = false) {
if (!force && getters.isCompareLoaded) return
commit(types.SET_COMPARE_LOADED)
cacheStorage.getItem('current-compare', (err, storedItems) => {
if (err) throw new Error(err)
commit(types.COMPARE_LOAD_COMPARE, storedItems)
Expand Down
3 changes: 2 additions & 1 deletion core/modules/compare/store/getters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import CompareState from '../types/CompareState'

const getters: GetterTree<CompareState, RootState> = {
isEmpty: (state) => state.items.length === 0,
isOnCompare: (state) => (product) => state.items.find(p => p.sku === product.sku)
isOnCompare: (state) => (product) => state.items.find(p => p.sku === product.sku),
isCompareLoaded: state => state.loaded
}

export default getters
1 change: 1 addition & 0 deletions core/modules/compare/store/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import CompareState from '../types/CompareState'
export const module: Module<CompareState, RootState> = {
namespaced: true,
state: {
loaded: false,
items: []
},
getters,
Expand Down
1 change: 1 addition & 0 deletions core/modules/compare/store/mutation-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ export const SN_COMPARE = 'compare'
export const COMPARE_ADD_ITEM = SN_COMPARE + '/ADD'
export const COMPARE_DEL_ITEM = SN_COMPARE + '/DEL'
export const COMPARE_LOAD_COMPARE = SN_COMPARE + '/LOAD'
export const SET_COMPARE_LOADED = `${SN_COMPARE}/SET_COMPARE_LOADED`
3 changes: 3 additions & 0 deletions core/modules/compare/store/mutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ const mutations: MutationTree<CompareState> = {
},
[types.COMPARE_LOAD_COMPARE] (state, storedItems) {
state.items = storedItems || []
},
[types.SET_COMPARE_LOADED] (state, isLoaded: boolean = true) {
state.loaded = isLoaded
}
}

Expand Down
4 changes: 4 additions & 0 deletions core/modules/compare/types/CompareState.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
export default interface CompareState {
/**
* Informs if items to compare are already loaded from local cache.
*/
loaded: boolean,
items: any[]
}
5 changes: 3 additions & 2 deletions core/modules/wishlist/store/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ const actions: ActionTree<WishlistState, RootState> = {
clear (context) {
context.commit(types.WISH_LOAD_WISH, [])
},
load (context) {
const commit = context.commit
load ({ commit, getters }, force: boolean = false) {
if (!force && getters.isWishlistLoaded) return
commit(types.SET_WISHLIST_LOADED)
cacheStorage.getItem('current-wishlist', (err, storedItems) => {
if (err) throw new Error(err)
commit(types.WISH_LOAD_WISH, storedItems)
Expand Down
6 changes: 5 additions & 1 deletion core/modules/wishlist/store/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@ import WishlistState from '../types/WishlistState'
export const module:Module<WishlistState, RootState> = {
namespaced: true,
state: {
loaded: false,
items: []
},
actions,
mutations
mutations,
getters: {
isWishlistLoaded: state => state.loaded
}
}

3 changes: 2 additions & 1 deletion core/modules/wishlist/store/mutation-types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export const SN_WISHLIST = 'wishlist'
export const WISH_ADD_ITEM = SN_WISHLIST + '/ADD'
export const WISH_DEL_ITEM = SN_WISHLIST + '/DEL'
export const WISH_LOAD_WISH = SN_WISHLIST + '/LOAD'
export const WISH_LOAD_WISH = SN_WISHLIST + '/LOAD'
export const SET_WISHLIST_LOADED = `${SN_WISHLIST}/SET_WISHLIST_LOADED`
3 changes: 3 additions & 0 deletions core/modules/wishlist/store/mutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ const mutations: MutationTree<WishlistState> = {
},
[types.WISH_LOAD_WISH] (state, storedItems) {
state.items = storedItems || []
},
[types.SET_WISHLIST_LOADED] (state, isLoaded: boolean = true) {
state.loaded = isLoaded
}
}

Expand Down
4 changes: 4 additions & 0 deletions core/modules/wishlist/types/WishlistState.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
export default interface WishlistState {
/**
* Informs if wishlist is already loaded from local cache.
*/
loaded: boolean,
items: any[]
}
29 changes: 20 additions & 9 deletions src/themes/default/components/core/blocks/Category/Sidebar.vue
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<template>
<div class="sidebar">
<h4>
{{ $t('Filter') }}
<h4 class="sidebar__header">
<span> {{ $t('Filter') }} </span>
<button
class="no-outline brdr-none py15 px40 bg-cl-mine-shaft :bg-cl-th-secondary ripple h5 cl-white sans-serif"
@click="resetAllFilters"
v-show="hasActiveFilters"
>
{{ $t('Clear') }}
</button>
</h4>
<button
class="no-outline brdr-none py15 px40 bg-cl-mine-shaft :bg-cl-th-secondary ripple h5 cl-white sans-serif"
@click="resetAllFilters"
v-show="hasActiveFilters"
>
{{ $t('Clear') }}
</button>
<div
v-for="(filter, filterIndex) in availableFilters"
:key="filterIndex"
Expand Down Expand Up @@ -99,3 +99,14 @@ export default {
mixins: [Sidebar]
}
</script>

<style lang="scss" scoped>
.sidebar {
&__header {
display: flex;
justify-content: space-between;
align-items: center;
min-height: 47px;
}
}
</style>

0 comments on commit f47057a

Please sign in to comment.