You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Multidomain support is possible to achieve right now but it requires tricky changes in core. It will be available in refactored Multistore which should be released in 1.13/1.14
7
+
- Different theme for different store is not supported right now. If you want to achieve that - the easiest way would be to just run 2 instances with different configs. If you want to change only parts of theme based on current store then you can easily achieve it with helpers described below.
8
+
- No support for multicurrency per store
9
+
5
10
## Multiwebsite indexing
6
11
7
-
Multiwebsite support starts with the Elasticsearch indexing. Basically, each store has its own Elasticsearch index and should be populated separately using the [mage2vuestorefront](https://github.com/DivanteLtd/mage2vuestorefront) tool.
12
+
Multiwebsite support starts with the Elasticsearch indexing. Basically, each store has its own Elasticsearch index and should be populated using the [Magento2 VSBridge Indexer](https://github.com/DivanteLtd/magento2-vsbridge-indexer) tool.
8
13
9
14
:::warning
10
15
11
-
Using node indexer to enable _multistore_ feature for _Vue Storefront_ has been deprecated.
12
-
You can use _Bridge Indexer_ for the better performance and maintainability. For Magento 2, you can find it [here](https://github.com/DivanteLtd/magento2-vsbridge-indexer)
16
+
There is legacy node indexer which has been deprecated. You should not use `mage2vuestorefront` anymore in production! The only acceptable reason to using it - is to provide data to your local Elasticsearch cluster from development instance.
13
17
:::
14
18
15
-
The simplest script to index multi site:
19
+
The simplest script to provide data to your local Elasticsearch:
16
20
17
21
```bash
18
22
export TIME_TO_EXIT=2000
@@ -60,7 +64,7 @@ In the result, you should get:
60
64
-_vue_storefront_catalog_de_ - populated with the "it" store data
61
65
-_vue_storefront_catalog_ - populated with the "default" store data
62
66
63
-
Then, to use these indexes in Vue Storefront, you should index the database schema using the `vue-storefront-api` db tool:
67
+
Then, to use these indices in Vue Storefront, you should index the database schema using the `vue-storefront-api` db tool (use only if using mage2vuestorefront!):
64
68
65
69
```bash
66
70
yarn db rebuild -- --indexName=vue_storefront_catalog_it
@@ -85,98 +89,99 @@ After this sequence of command, you may add the available ES index to your `vue-
85
89
"vue_storefront_catalog_it"
86
90
],
87
91
"availableStores": [
88
-
"de", "it"
92
+
"de",
93
+
"it"
89
94
],
90
-
95
+
// ...
91
96
```
92
97
93
98
The last thing is to change the `vue-storefront/config/local.json` to configure the storeViews that are available.
94
99
95
100
```json
96
-
"storeViews": {
97
-
"multistore": false,
98
-
"mapStoreUrlsFor": ["de", "it"],
99
-
"de": {
100
-
"storeCode": "de",
101
-
"storeId": 3,
102
-
"name": "German Store",
103
-
"url": "/de",
104
-
"elasticsearch": {
105
-
"host": "localhost:8080/api/catalog",
106
-
"index": "vue_storefront_catalog_de"
107
-
},
108
-
"tax": {
109
-
"defaultCountry": "DE",
110
-
"defaultRegion": "",
111
-
"sourcePriceIncludesTax": false,
112
-
"calculateServerSide": true,
113
-
"userGroupId": null,
114
-
"useOnlyDefaultUserGroupId": false,
115
-
"deprecatedPriceFieldsSupport": true,
116
-
"finalPriceIncludesTax": false
117
-
},
118
-
"i18n": {
119
-
"defaultCountry": "DE",
120
-
"defaultLanguage": "DE",
121
-
"availableLocale": [
122
-
"de-DE"
123
-
],
124
-
"defaultLocale": "de-DE",
125
-
"currencyCode": "EUR",
126
-
"currencySign": "€",
127
-
"currencyDecimal": "",
128
-
"currencyGroup": "",
129
-
"fractionDigits": 2,
130
-
"priceFormat": "{sign}{amount}",
131
-
"dateFormat": "HH:mm D/M/YYYY",
132
-
"fullCountryName": "Deutschland",
133
-
"fullLanguageName": "German",
134
-
"bundleAllStoreviewLanguages": false
135
-
}
136
-
},
137
-
"it": {
138
-
"storeCode": "it",
139
-
"storeId": 4,
140
-
"name": "Italian Store",
141
-
"url": "/it",
142
-
"elasticsearch": {
143
-
"host": "localhost:8080/api/catalog",
144
-
"index": "vue_storefront_catalog_it"
145
-
},
146
-
"tax": {
147
-
"defaultCountry": "IT",
148
-
"defaultRegion": "",
149
-
"sourcePriceIncludesTax": false,
150
-
"calculateServerSide": true,
151
-
"userGroupId": null,
152
-
"useOnlyDefaultUserGroupId": false,
153
-
"deprecatedPriceFieldsSupport": true,
154
-
"finalPriceIncludesTax": false
155
-
},
156
-
"i18n": {
157
-
"defaultCountry": "IT",
158
-
"defaultLanguage": "IT",
159
-
"availableLocale": [
160
-
"it-IT"
161
-
],
162
-
"defaultLocale": "it-IT",
163
-
"currencyCode": "EUR",
164
-
"currencySign": "€",
165
-
"currencyDecimal": "",
166
-
"currencyGroup": "",
167
-
"fractionDigits": 2,
168
-
"priceFormat": "{sign}{amount}",
169
-
"dateFormat": "HH:mm D/M/YYYY",
170
-
"fullCountryName": "Italy",
171
-
"fullLanguageName": "Italian",
172
-
"bundleAllStoreviewLanguages": false
173
-
}
174
-
}
101
+
"storeViews": {
102
+
"multistore": false,
103
+
"mapStoreUrlsFor": ["de", "it"],
104
+
"de": {
105
+
"storeCode": "de",
106
+
"storeId": 3,
107
+
"name": "German Store",
108
+
"url": "/de",
109
+
"elasticsearch": {
110
+
"host": "localhost:8080/api/catalog",
111
+
"index": "vue_storefront_catalog_de"
175
112
},
113
+
"tax": {
114
+
"defaultCountry": "DE",
115
+
"defaultRegion": "",
116
+
"sourcePriceIncludesTax": false,
117
+
"calculateServerSide": true,
118
+
"userGroupId": null,
119
+
"useOnlyDefaultUserGroupId": false,
120
+
"deprecatedPriceFieldsSupport": true,
121
+
"finalPriceIncludesTax": false
122
+
},
123
+
"i18n": {
124
+
"defaultCountry": "DE",
125
+
"defaultLanguage": "DE",
126
+
"availableLocale": [
127
+
"de-DE"
128
+
],
129
+
"defaultLocale": "de-DE",
130
+
"currencyCode": "EUR",
131
+
"currencySign": "€",
132
+
"currencyDecimal": "",
133
+
"currencyGroup": "",
134
+
"fractionDigits": 2,
135
+
"priceFormat": "{sign}{amount}",
136
+
"dateFormat": "HH:mm D/M/YYYY",
137
+
"fullCountryName": "Deutschland",
138
+
"fullLanguageName": "German",
139
+
"bundleAllStoreviewLanguages": false
140
+
}
141
+
},
142
+
"it": {
143
+
"storeCode": "it",
144
+
"storeId": 4,
145
+
"name": "Italian Store",
146
+
"url": "/it",
147
+
"elasticsearch": {
148
+
"host": "localhost:8080/api/catalog",
149
+
"index": "vue_storefront_catalog_it"
150
+
},
151
+
"tax": {
152
+
"defaultCountry": "IT",
153
+
"defaultRegion": "",
154
+
"sourcePriceIncludesTax": false,
155
+
"calculateServerSide": true,
156
+
"userGroupId": null,
157
+
"useOnlyDefaultUserGroupId": false,
158
+
"deprecatedPriceFieldsSupport": true,
159
+
"finalPriceIncludesTax": false
160
+
},
161
+
"i18n": {
162
+
"defaultCountry": "IT",
163
+
"defaultLanguage": "IT",
164
+
"availableLocale": [
165
+
"it-IT"
166
+
],
167
+
"defaultLocale": "it-IT",
168
+
"currencyCode": "EUR",
169
+
"currencySign": "€",
170
+
"currencyDecimal": "",
171
+
"currencyGroup": "",
172
+
"fractionDigits": 2,
173
+
"priceFormat": "{sign}{amount}",
174
+
"dateFormat": "HH:mm D/M/YYYY",
175
+
"fullCountryName": "Italy",
176
+
"fullLanguageName": "Italian",
177
+
"bundleAllStoreviewLanguages": false
178
+
}
179
+
}
180
+
},
176
181
```
177
182
178
183
:::tip
179
-
You can find more options available to _multistore_ features in [store view](/guide/basics/configuration.html#store-views) section of _Configuration File Explained_.
184
+
You can find more options available to _multistore_ in [store view](/guide/basics/configuration.html#store-views) section of _Configuration File Explained_.
180
185
:::
181
186
182
187
After these changes, you'll have a `LanguageSwitcher` component visible on the bottom.
@@ -194,7 +199,7 @@ The storeCode may be switched by ENV variable set before running `yarn dev` / `y
194
199
195
200
- `export STORE_CODE=de && yarn dev` will run the shop with the `de` shop loaded
196
201
197
-
Another option, useful when using multistore mode with the NGINX/varnish mode, is to set the shop code by the `x-vs-store-code` http reqeuest header.
202
+
Another option, useful when using multistore mode with the NGINX/varnish mode, is to set the store code by the `x-vs-store-code` HTTP header.
Another option is to create a separate theme for a specific storeview. Runtime theme changes are not possible, as themes are compiled in the JS bundles by webpack during the page build process. In that case, you should run separate instances of `vue-storefront` having the proper theme set in the `config/local.json` file.
216
221
222
+
## Multi Source Inventory (MSI) support
223
+
To support this custom feature you should take care of 2 things. At first please install [Magento2 VSBridge Indexer MSI Extension](https://github.com/DivanteLtd/magento2-vsbridge-indexer-msi). Then in `config/local.json` of your VSF-API add part like:
224
+
```js
225
+
"msi": {
226
+
"enabled":true,
227
+
"defaultStockId":1
228
+
},
229
+
```
230
+
Where `defaultStockId` is your default stock ID. In each storeCode, which uses different stock ID you should add part like:
231
+
```js
232
+
"msi": {
233
+
"stockId":2
234
+
},
235
+
```
236
+
217
237
## Useful _Helpers_
218
238
219
239
### How to get current store view?
@@ -231,7 +251,7 @@ import { currentStoreView } from '@vue-storefront/core/lib/multistore'
231
251
}
232
252
```
233
253
234
-
`currentStoreView()`will return the object value you set in `local.json` - it should be type of StoreView or extended StoreView.
254
+
`currentStoreView()`returns the object value you set in `local.json` - it is type of StoreView or extended StoreView.
235
255
```ts
236
256
interfaceStoreView {
237
257
storeCode:string,
@@ -277,7 +297,7 @@ interface StoreView {
277
297
278
298
### How to remove store code from route
279
299
280
-
When you need to remove `storeCode` from route in such a case you want to route to default store by mapping fallback, use `removeStoreCodeFromRoute` as following example :
300
+
When you need to remove `storeCode` from route, use `removeStoreCodeFromRoute` as following example :
It will use `storeCode` query parameter from the `req` to figure out which store to use. To make it work properly you should also configure different stores in your VSF-API's config. Check this example configuration for `de` and `it` store codes:
337
+
It uses `storeCode` query parameter from the `req` to figure out which store to use. To make it work properly you should also configure different stores in your VSF-API's config. Check this example configuration for `de` and `it` store codes:
`localizedRoute` is injected to each Vue's instance so you can access it in your component with`this.localizedRoute`. You could also use it in template without additional imports.
386
+
`localizedRoute` is injected to each Vue's instance so you can access it in your component via`this.localizedRoute`. You could also use it in template without additional imports.
372
387
:::
373
388
374
389
```vue
@@ -401,7 +416,7 @@ You can extract store code from route as follows :
0 commit comments