Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed

- Use LRU as object contructor based on newest changes in module - @gibkigonzo (#4242)
- Fixes problems related to tax calculation and price filter in multistore setup - @juho-jaakkola (#4376)


## [1.11.3] - 2020.04.27
Expand Down
4 changes: 3 additions & 1 deletion core/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ export interface StoreView {
index: string
},
tax: {
sourcePriceIncludesTax: boolean,
sourcePriceIncludesTax?: boolean,
finalPriceIncludesTax?: boolean,
deprecatedPriceFieldsSupport?: boolean,
defaultCountry: string,
defaultRegion: null | string,
calculateServerSide: boolean,
Expand Down
6 changes: 3 additions & 3 deletions core/modules/catalog-next/store/category/getters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { getFiltersFromQuery } from '../../helpers/filterHelpers'
import { Category } from '../../types/Category'
import { parseCategoryPath } from '@vue-storefront/core/modules/breadcrumbs/helpers'
import { _prepareCategoryPathIds, getSearchOptionsFromRouteParams } from '../../helpers/categoryHelpers';
import { removeStoreCodeFromRoute } from '@vue-storefront/core/lib/multistore'
import { currentStoreView, removeStoreCodeFromRoute } from '@vue-storefront/core/lib/multistore'
import cloneDeep from 'lodash-es/cloneDeep'

function mapCategoryProducts (productsFromState, productsData) {
Expand Down Expand Up @@ -77,8 +77,8 @@ const getters: GetterTree<CategoryState, RootState> = {
});
filters[attrToFilter] = filterOptions.sort(compareByLabel)
} else { // special case is range filter for prices
const storeView = rootState.storeView
const currencySign = storeView.i18n.currencySign
const currencySign = currentStoreView().i18n.currencySign

if (aggregations['agg_range_' + attrToFilter]) {
let index = 0
let count = aggregations['agg_range_' + attrToFilter].buckets.length
Expand Down
5 changes: 4 additions & 1 deletion core/modules/catalog/store/tax/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import config from 'config'
import { calculateProductTax } from '@vue-storefront/core/modules/catalog/helpers/taxCalc'
import { doPlatformPricesSync } from '@vue-storefront/core/modules/catalog/helpers'
import { catalogHooksExecutors } from './../../hooks'
import { currentStoreView } from '@vue-storefront/core/lib/multistore';

const actions: ActionTree<TaxState, RootState> = {
async list ({ state, commit, dispatch }, { entityType = 'taxrule' }) {
Expand Down Expand Up @@ -48,14 +49,16 @@ const actions: ActionTree<TaxState, RootState> = {
return doPlatformPricesSync(mutatedProducts)
}

let storeView = currentStoreView()

const tcs = await dispatch('list', {})
const {
defaultCountry,
defaultRegion,
sourcePriceIncludesTax,
finalPriceIncludesTax,
deprecatedPriceFieldsSupport
} = rootState.storeView.tax
} = storeView.tax

const recalculatedProducts = mutatedProducts.map(product =>
calculateProductTax({
Expand Down
3 changes: 2 additions & 1 deletion core/modules/catalog/store/tax/getters.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { GetterTree } from 'vuex'
import RootState from '@vue-storefront/core/types/RootState'
import TaxState from '../../types/TaxState'
import { currentStoreView } from '@vue-storefront/core/lib/multistore';

const getters: GetterTree<TaxState, RootState> = {
getRules: (state) => state.rules,
Expand All @@ -17,7 +18,7 @@ const getters: GetterTree<TaxState, RootState> = {
return currentUser.group_id
},
getIsUserGroupedTaxActive: (state, getters, rootState) => {
return typeof rootState.storeView.tax.userGroupId === 'number'
return typeof currentStoreView().tax.userGroupId === 'number'
}
}

Expand Down