-
Notifications
You must be signed in to change notification settings - Fork 169
storefront:hot-proxy not working with multiple sales channels #111
Comments
By the way: I'm using Shopware 6.2.2 |
Hello, being a big fan of Hot Module Reload, I have been digging around in the Shopware (6.4+) Webpack setup (with the goal of optimising storefront performance). I have it working with a couple of hacks and pitfalls for multiple themes for different sales channels! Let's discuss and improve from here:
This means which Theme Configuration ends up in For now I've made this work by adding a
// Addition in build/proxy-server-hot/index.js
if (client_req.url.indexOf('/font/') >= 0) {
requestOptions.host = '127.0.0.1';
requestOptions.port = 80; // route to apache
} Maybe this is something the asset server on port 9999, could handle? $app-css-relative-asset-path: '/theme/<themehashid>/assets'; // webpack.config.js
const scssEntryFileContent = (() => {
const themeMappings = JSON.parse(fs.readFileSync(path.resolve(projectRootPath, 'files/theme-config/index.json'), { encoding: 'utf8' }));
const assetIds = Object.keys(themeMappings).map(salesChannelId => md5(themeMappings[salesChannelId] + salesChannelId)); // like the MD5ThemePathBuilder.assemblePath method
const themeHashForAssetPath = assetIds[THEME_INDEX];
const themeConfig = JSON.parse(fs.readFileSync(path.resolve(projectRootPath, `files/theme-config/${Object.values(themeMappings)[THEME_INDEX]}.json`), { encoding: 'utf8' }));
// [...] now we need `var/` contents, but it's only for the one theme...
@AlexBa does my information help you "to make it work" for you too? |
Any update on this? This would be nice to have as basic functionality. |
hey @jellesiderius please check if the Symfony Flex template is now providing what you need: https://github.com/shopware/recipes If not, please open an issue there. As stated here in the readme file, this repo is deprecated |
Hey,
I have an annoying issue which I first have discovered 1-2 months ago: If I want to use "./psh.phar storefront:hot-proxy" with multiple sales channels, the resulting site is broken.
With broken I mean: Specific templates like the header are applied multiple times to the site. Additionally, I'm using a premium theme from the community store (Orion), but the used theme in the hot proxy is still the default Storefront theme. Some styling is missing too.
If I delete all sales channels except the one with the premium theme, everything is working correctly. Deleting a sales channel means: Delete all related orders, documents, customers & newsletter recipients which are using the sales channel (with a raw MySQL query).
Unfortunately, it's not possible to delete a sales channel in the admin easily. If I click on "delete", nothing happens. Only an error appears in the AJAX response. The problem are the foreign key constraints in the DB. I think deleting a sales channels with existing data should be handled differently. But this is a different topic.
Does anyone have the same problem?
The text was updated successfully, but these errors were encountered: