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
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.
8
8
9
+
:::warning
10
+
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)
13
+
:::
14
+
9
15
The simplest script to index multi site:
10
16
11
17
```bash
@@ -102,17 +108,30 @@ The last thing is to change the `vue-storefront/config/local.json` to configure
102
108
"tax": {
103
109
"defaultCountry": "DE",
104
110
"defaultRegion": "",
105
-
"calculateServerSide": true
111
+
"sourcePriceIncludesTax": false,
112
+
"calculateServerSide": true,
113
+
"userGroupId": null,
114
+
"useOnlyDefaultUserGroupId": false,
115
+
"deprecatedPriceFieldsSupport": true,
116
+
"finalPriceIncludesTax": false
106
117
},
107
118
"i18n": {
108
-
"fullCountryName": "Germany",
109
-
"fullLanguageName": "German",
110
-
"defaultLanguage": "DE",
111
119
"defaultCountry": "DE",
120
+
"defaultLanguage": "DE",
121
+
"availableLocale": [
122
+
"de-DE"
123
+
],
112
124
"defaultLocale": "de-DE",
113
125
"currencyCode": "EUR",
114
-
"currencySign": "EUR",
115
-
"dateFormat": "HH:mm D-M-YYYY"
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
116
135
}
117
136
},
118
137
"it": {
@@ -125,24 +144,41 @@ The last thing is to change the `vue-storefront/config/local.json` to configure
125
144
"index": "vue_storefront_catalog_it"
126
145
},
127
146
"tax": {
128
-
"defaultCountry": "DE",
147
+
"defaultCountry": "IT",
129
148
"defaultRegion": "",
130
-
"calculateServerSide": true
149
+
"sourcePriceIncludesTax": false,
150
+
"calculateServerSide": true,
151
+
"userGroupId": null,
152
+
"useOnlyDefaultUserGroupId": false,
153
+
"deprecatedPriceFieldsSupport": true,
154
+
"finalPriceIncludesTax": false
131
155
},
132
156
"i18n": {
133
-
"fullCountryName": "Italy",
134
-
"fullLanguageName": "Italian",
135
157
"defaultCountry": "IT",
136
158
"defaultLanguage": "IT",
159
+
"availableLocale": [
160
+
"it-IT"
161
+
],
137
162
"defaultLocale": "it-IT",
138
163
"currencyCode": "EUR",
139
-
"currencySign": "EUR",
140
-
"dateFormat": "HH:mm D-M-YYYY"
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
141
173
}
142
174
}
143
175
},
144
176
```
145
177
178
+
:::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_.
180
+
:::
181
+
146
182
After these changes, you'll have a `LanguageSwitcher` component visible on the bottom.
147
183
148
184
By default, the language / store is switched by the URL prefix:
@@ -204,3 +240,121 @@ or
204
240
"
205
241
></router-link>
206
242
```
243
+
244
+
## Useful _Helpers_
245
+
246
+
### How to get current store view?
247
+
248
+
Here is a helper method to get the value of current store view.
249
+
250
+
You just need to import `currentStoreView` function from `core/lib/multistore` as example follows:
`currentStoreView()` will return the object value you set in `local.json` - it should be type of StoreView or extended StoreView.
262
+
```ts
263
+
interfaceStoreView {
264
+
storeCode:string,
265
+
extend?:string,
266
+
disabled?:boolean,
267
+
storeId:any,
268
+
name?:string,
269
+
url?:string,
270
+
appendStoreCode?:boolean,
271
+
elasticsearch: {
272
+
host:string,
273
+
index:string
274
+
},
275
+
tax: {
276
+
sourcePriceIncludesTax?:boolean,
277
+
finalPriceIncludesTax?:boolean,
278
+
deprecatedPriceFieldsSupport?:boolean,
279
+
defaultCountry:string,
280
+
defaultRegion:null|string,
281
+
calculateServerSide:boolean,
282
+
userGroupId?:number,
283
+
useOnlyDefaultUserGroupId:boolean
284
+
},
285
+
i18n: {
286
+
fullCountryName:string,
287
+
fullLanguageName:string,
288
+
defaultLanguage:string,
289
+
defaultCountry:string,
290
+
defaultLocale:string,
291
+
currencyCode:string,
292
+
currencySign:string,
293
+
currencyDecimal:string,
294
+
currencyGroup:string,
295
+
fractionDigits:number,
296
+
priceFormat:string,
297
+
dateFormat:string
298
+
},
299
+
seo: {
300
+
defaultTitle:string
301
+
}
302
+
}
303
+
```
304
+
305
+
### How to remove store code from route
306
+
307
+
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 :
If you need to append or update `storeCode` query parameter in provided URL you can do it by calling `adjustMultistoreApiUrl` function as following example:
0 commit comments