Skip to content

Commit

Permalink
Merge branch 'develop' into bugfix/3674
Browse files Browse the repository at this point in the history
  • Loading branch information
patzick committed Oct 3, 2019
2 parents 4aad4c2 + 6f5dba3 commit e524360
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 15 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Route Manager Queue for adding routes efficiently and with an optional priority - @grimasod (#3540)
- Added tests for cart module actions - @andrzejewsky (#3023)
- Fixed a problem with type changes in the state when extending a store - @resubaka (#3618)
- Fixed problem with bundle product where they have the same hash as other products - @resubaka (#3657)

### Fixed

Expand Down Expand Up @@ -128,12 +127,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add missing parameters (`size`,`start`) to `quickSearchByQuery()` in `attribute/list` action - @cewald (#3627)
- Fix breadcrumb homepage link in cms static pages - @andrzejewsky (#3631)
- Fixed special price that can break when you change pages (browser navigation for/back) or just go from category to product page - @resubaka (#3638)
- Fixed wrong links on the static pages - @andrzejewsky (#3659)
- Fixed problem with changing quantity in offline mode on product page - @andrzejewsky (#3662)
- Fixed problem with extending storeView configuration - @andrzejewsky (#3655)
- Removed infinite loop when changing checkbox in shipping details - @gibkigonzo (#3656)
- Fixed displaying single order in the profile - @andrzejewsky (#3663)
- Make microcart ui consistent for all types of products - @gibkigonzo (#3673)
- Fixed missing storeCode in metaInfo - @andrzejewsky (#3674)
- Removed showing popup when you have just logged out - @andrzejewsky (#3680)

### Changed / Improved

Expand Down
14 changes: 11 additions & 3 deletions core/modules/cart/helpers/productChecksum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,18 @@ import CartItem from '@vue-storefront/core/modules/cart/types/CartItem'
import { sha3_224 } from 'js-sha3'

const getDataToHash = (product: CartItem): any => {
return {
product_option: product.product_option,
sku: product.sku
if (!product.product_option) {
return null
}

const { extension_attributes } = product.product_option

if (extension_attributes.bundle_options) {
const { bundle_options } = extension_attributes
return Array.isArray(bundle_options) ? bundle_options : Object.values(bundle_options)
}

return product.product_option
}

const productChecksum = (product: CartItem): string =>
Expand Down
4 changes: 2 additions & 2 deletions core/modules/cart/test/unit/helpers/productChecksum.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ const bundleProduct: CartItem = {

describe('Cart productChecksum', () => {
it('returns checksum for bundle product', async () => {
expect(productChecksum(bundleProduct)).toBe('3a3c1864b9ecd7cd66ab52d7ed2aab4fd2c8e232dffc2a59902d7b90');
expect(productChecksum(bundleProduct)).toBe('d8ba5d5baf59fe28647d6a08fdaeb683a7b39ccdebc77eecabc6457c');
});

it('returns checksum for configurable product', async () => {
expect(productChecksum(configurableProduct)).toBe('c0781e146b8b799836585d19ad3b7a6fb465dfdd2b7d9dcad0793b6b');
expect(productChecksum(configurableProduct)).toBe('0bbb27ec7a3cb5dfd1d3f6c4ee54c8b522c4063fe6ea0571794d446f');
});
});
7 changes: 2 additions & 5 deletions src/themes/default/components/core/blocks/Footer/Footer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -163,15 +163,13 @@ import CurrentPage from 'theme/mixins/currentPage'
import LanguageSwitcher from '../../LanguageSwitcher.vue'
import Newsletter from 'theme/components/core/blocks/Footer/Newsletter'
import BackToTop from 'theme/components/core/BackToTop'
import { getPathForStaticPage } from 'theme/helpers'
import config from 'config'
export default {
mixins: [CurrentPage],
name: 'MainFooter',
computed: {
isStoreCodeEquals () {
return currentStoreView().storeCode === config.defaultStoreCode
},
multistoreEnabled () {
return config.storeViews.multistore
},
Expand All @@ -181,8 +179,7 @@ export default {
},
methods: {
getLinkFor (path) {
const route = this.isStoreCodeEquals ? `/i${path}` : path
return localizedRoute(route)
return localizedRoute(getPathForStaticPage(path))
}
},
components: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export default {
},
methods: {
logout () {
this.$bus.$emit('user-before-logout')
this.$store.dispatch('user/logout', {})
this.$router.push(this.localizedRoute('/'))
},
notify (title) {
Expand Down
9 changes: 9 additions & 0 deletions src/themes/default/helpers/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import config from 'config'
import { currentStoreView } from '@vue-storefront/core/lib/multistore'

export function getPathForStaticPage (path: string) {
const { storeCode } = currentStoreView()
const isStoreCodeEquals = storeCode === config.defaultStoreCode

return isStoreCodeEquals ? `/i${path}` : path
}
7 changes: 4 additions & 3 deletions src/themes/default/pages/Static.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import i18n from '@vue-storefront/i18n'
import Breadcrumbs from 'theme/components/core/Breadcrumbs'
import StaticExample from 'theme/components/theme/blocks/Static/Example'
import StaticShortExample from 'theme/components/theme/blocks/Static/Short'
import { getPathForStaticPage } from 'theme/helpers'
export default {
components: {
Expand Down Expand Up @@ -65,9 +66,9 @@ export default {
data () {
return {
navigation: [
{ title: i18n.t('About us'), link: '/about-us', component: StaticExample },
{ title: i18n.t('Customer service'), link: '/customer-service', component: StaticShortExample },
{ title: i18n.t('Store locator'), link: '/store-locator', component: StaticExample },
{ title: i18n.t('About us'), link: getPathForStaticPage('/about-us'), component: StaticExample },
{ title: i18n.t('Customer service'), link: getPathForStaticPage('/customer-service'), component: StaticShortExample },
{ title: i18n.t('Store locator'), link: getPathForStaticPage('/store-locator'), component: StaticExample },
{ title: i18n.t('Delivery'), link: '/delivery', component: StaticShortExample },
{ title: i18n.t('Return policy'), link: '/returns', component: StaticExample },
{ title: i18n.t('Privacy policy'), link: '/privacy', component: StaticShortExample },
Expand Down

0 comments on commit e524360

Please sign in to comment.