Skip to content

Commit

Permalink
Merge pull request #1976 from kjugi/feature/887
Browse files Browse the repository at this point in the history
Feature/887
  • Loading branch information
filrak committed Nov 13, 2018
2 parents 57de266 + 825b722 commit a344ce8
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 17 deletions.
5 changes: 1 addition & 4 deletions core/components/blocks/Category/Sidebar.js
Expand Up @@ -23,10 +23,7 @@ export default {
resetAllFilters () {
this.$bus.$emit('filter-reset')
this.$store.dispatch('category/resetFilters')
const filterQr = buildFilterProductsQuery(this.category, this.activeFilters)
this.$store.state.category.current_product_query = Object.assign(this.$store.state.category.current_product_query, {
searchProductQuery: filterQr
})
this.$store.dispatch('category/searchProductQuery', buildFilterProductsQuery(this.category, this.activeFilters))
this.$store.dispatch('category/products', this.$store.state.category.current_product_query)
}
}
Expand Down
16 changes: 11 additions & 5 deletions core/components/blocks/Checkout/Shipping.js
Expand Up @@ -41,7 +41,13 @@ export default {
}),
...mapGetters({
shippingMethods: 'shipping/shippingMethods'
})
}),
checkoutShippingDetails () {
return this.$store.state.checkout.shippingDetails
},
paymentMethod () {
return this.$store.state.payment.methods
}
},
mounted () {
if (!this.shipping.shippingMethod || this.notInMethods(this.shipping.shippingMethod)) {
Expand Down Expand Up @@ -102,11 +108,11 @@ export default {
apartmentNumber: this.myAddressDetails.street[1],
zipCode: this.myAddressDetails.postcode,
phoneNumber: this.myAddressDetails.telephone,
shippingMethod: this.$store.state.checkout.shippingDetails.shippingMethod,
shippingCarrier: this.$store.state.checkout.shippingDetails.shippingCarrier
shippingMethod: this.checkoutShippingDetails.shippingMethod,
shippingCarrier: this.checkoutShippingDetails.shippingCarrier
}
} else {
this.shipping = this.$store.state.checkout.shippingDetails
this.shipping = this.checkoutShippingDetails
}
this.changeCountry()
},
Expand Down Expand Up @@ -147,7 +153,7 @@ export default {
country: this.shipping.country,
method_code: currentShippingMethod.method_code,
carrier_code: currentShippingMethod.carrier_code,
payment_method: this.$store.state.payment.methods[0].code
payment_method: this.paymentMethod[0].code
})
}
},
Expand Down
4 changes: 2 additions & 2 deletions core/components/blocks/MyAccount/MyNewsletter.js
Expand Up @@ -10,14 +10,14 @@ export default {
},
methods: {
unsubscribe () {
this.$store.dispatch('mailchimp/unsubscribe', this.$store.state.user.current.email).then(res => {
this.$store.dispatch('mailchimp/unsubscribe', this.$store.state.user.current.email).then(() => {
this.user.isSubscribed = false
}).catch(err =>
this.$emit('unsubscription-error', err)
)
},
subscribe () {
this.$store.dispatch('mailchimp/subscribe', this.$store.state.user.current.email).then(res => {
this.$store.dispatch('mailchimp/subscribe', this.$store.state.user.current.email).then(() => {
this.user.isSubscribed = true
}).catch(err =>
this.$emit('subscription-error', err)
Expand Down
4 changes: 3 additions & 1 deletion core/store/modules/category/actions.ts
Expand Up @@ -305,9 +305,11 @@ const actions: ActionTree<CategoryState, RootState> = {
}
return productPromise
},

resetFilters (context) {
context.commit(types.CATEGORY_REMOVE_FILTERS)
},
searchProductQuery (context, productQuery) {
context.commit(types.CATEGORY_UPD_SEARCH_PRODUCT_QUERY, productQuery)
}
}

Expand Down
3 changes: 3 additions & 0 deletions core/store/modules/category/mutations.ts
Expand Up @@ -42,6 +42,9 @@ const mutations: MutationTree<CategoryState> = {
[types.CATEGORY_REMOVE_FILTERS] (state) {
state.filters.chosen = {}
state.current_product_query.configuration = {}
},
[types.CATEGORY_UPD_SEARCH_PRODUCT_QUERY] (state, newQuery) {
state.current_product_query = newQuery
}
}

Expand Down
1 change: 1 addition & 0 deletions core/store/mutation-types.ts
Expand Up @@ -26,6 +26,7 @@ export const SN_CATEGORY = 'category'
export const CATEGORY_UPD_CATEGORIES = SN_CATEGORY + '/UPD_CATEGORIES'
export const CATEGORY_UPD_CURRENT_CATEGORY = SN_CATEGORY + '/UPD_CURRENT_CATEGORY'
export const CATEGORY_UPD_CURRENT_CATEGORY_PATH = SN_CATEGORY + '/UPD_CURRENT_CATEGORY_PATH'
export const CATEGORY_UPD_SEARCH_PRODUCT_QUERY = SN_CATEGORY + '/UPD_SEARCH_PRODUCT_QUERY'
export const CATEGORY_REMOVE_FILTERS = SN_CATEGORY + '/REMOVE_FILTERS'

export const SN_PRODUCT = 'product'
Expand Down
Expand Up @@ -96,6 +96,12 @@ export default {
isPermissionGranted () {
if (Vue.prototype.$isServer || !('Notification' in window)) return false
return Notification.permission === 'granted'
},
checkoutPersonalEmailAddress () {
return this.$store.state.checkout.personalDetails.emailAddress
},
mailerElements () {
return this.$store.state.config.mailer.contactAddress
}
},
methods: {
Expand All @@ -108,8 +114,8 @@ export default {
sendFeedback () {
this.sendEmail(
{
sourceAddress: this.$store.state.checkout.personalDetails.emailAddress,
targetAddress: this.$store.state.config.mailer.contactAddress,
sourceAddress: this.checkoutPersonalEmailAddress,
targetAddress: this.mailerElements.contactAddress,
subject: this.$t('What we can improve?'),
emailText: this.feedback
},
Expand All @@ -123,11 +129,11 @@ export default {
message,
action1: { label: this.$t('OK') }
})
if (this.$store.state.config.mailer.sendConfirmation) {
if (this.mailerElements.sendConfirmation) {
this.sendEmail(
{
sourceAddress: this.$store.state.config.mailer.contactAddress,
targetAddress: this.$store.state.checkout.personalDetails.emailAddress,
sourceAddress: this.mailerElements.contactAddress,
targetAddress: this.checkoutPersonalEmailAddress,
subject: this.$t('Confirmation of receival'),
emailText: this.$t(`Dear customer,\n\nWe have received your letter.\nThank you for your feedback!`),
confirmation: true
Expand Down

0 comments on commit a344ce8

Please sign in to comment.