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
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [1.12.0-rc1] - UNRELEASED

### Added

- Separating endpoints for CSR/SSR - @Fifciu (#2861)
- Added short hands for version and help flags - @jamesgeorge007 (#3946)
- Add `or` operator for Elasticsearch filters in `quickSearchByQuery` and use exists if value is `null` - @cewald (#3960)
Expand Down Expand Up @@ -53,6 +52,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Improve typescript support for test utils - @resubaka (#4067)
- Removed `product/loadConfigurableAttributes` calls - @andrzejewsky, @gibkigonzo (#3336)
- Disable `mapFallback` url by default - @gibkigonzo(#4092)
- Include token in pricing sync - @carlokok (#4156)

## [1.11.2] - 2020.03.10

Expand Down
1 change: 1 addition & 0 deletions config/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@
"listOutOfStockProducts": true,
"preventConfigurableChildrenDirectAccess": true,
"alwaysSyncPlatformPricesOver": false,
"alwaysSyncPricesClientSide": false,
"clearPricesBeforePlatformSync": false,
"waitForPlatformSync": false,
"setupVariantByAttributeCode": true,
Expand Down
4 changes: 4 additions & 0 deletions core/modules/catalog/store/product/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ const actions: ActionTree<ProductState, RootState> = {
url = `${url}&userGroupId=${rootGetters['tax/getUserTaxGroupId']}`
}

if (rootGetters['user/getToken']) {
url = `${url}&token=${rootGetters['user/getToken']}`
}

return TaskQueue.execute({ url, // sync the cart
payload: {
method: 'GET',
Expand Down
6 changes: 6 additions & 0 deletions docs/guide/basics/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,12 @@ This is related to `alwaysSyncPlatformPricesOver` and when it's set to true, the

This is related to `alwaysSyncPlatformPricesOver`. When true, Vue Storefront will wait for dynamic prices before rendering the page. Otherwise, the product and category pages will be rendered using the default (Elasticsearch-based) prices and then asynchronously override them with current ones.

```json
"alwaysSyncPricesClientSide": false,
```

This is related to `alwaysSyncPlatformPricesOver`. When true, Vue Storefront will force a refresh of the prices on the client side, including the token from the current logged in user, so customer specific pricing can be applied.


```json
"endpoint": "http://localhost:8080/api/product",
Expand Down
6 changes: 5 additions & 1 deletion src/themes/default/pages/Product.vue
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ import { registerModule, isModuleRegistered } from '@vue-storefront/core/lib/mod
import { onlineHelper, isServer, productJsonLd } from '@vue-storefront/core/helpers'
import { catalogHooksExecutors } from '@vue-storefront/core/modules/catalog-next/hooks'
import ProductPrice from 'theme/components/core/ProductPrice.vue'
import { doPlatformPricesSync } from '@vue-storefront/core/modules/catalog/helpers'

export default {
components: {
Expand Down Expand Up @@ -324,7 +325,7 @@ export default {
return currentStoreView()
},
getJsonLd () {
return productJsonLd(this.getCurrentProduct, this.getCurrentProductConfiguration.color.label, this.$store.state.storeView.i18n.currencyCode, this.getCustomAttributes)
return productJsonLd(this.getCurrentProduct, this.getCurrentProductConfiguration.color && this.getCurrentProductConfiguration.color.label, this.$store.state.storeView.i18n.currencyCode, this.getCustomAttributes)
}
},
async mounted () {
Expand Down Expand Up @@ -396,6 +397,9 @@ export default {
if (this.isStockInfoLoading) return // stock info is already loading
this.isStockInfoLoading = true
try {
if (config.products.alwaysSyncPricesClientSide) {
doPlatformPricesSync([this.getCurrentProduct]);
}
const res = await this.$store.dispatch('stock/check', {
product: this.getCurrentProduct,
qty: this.getCurrentProduct.qty
Expand Down