What are the Slack Archives?
Itβs a history of our time together in the Slack Community! Thereβs a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.
Because this space is not active, you wonβt be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..
We have some trouble with the stores setup in our environment. The setup is quite equal to the b2b D
We have some trouble with the stores setup in our environment. The setup is quite equal to the b2b Demo Shop: 2 stores sharing one database (like DE and AT in the demo shop), a third store with a separate Database (like US in the demo shop). One main difference is, that the locales differ between the 2 stores using the first DB and the third store using the second DB:
Store 1:
β’ DB 1
β’ Locale: de_DE
Store 2:
β’ DB 1
β’ Locale: de_DE
Store 3:
β’ DB 2
β’ Locales: de_CH, fr_CH, it_CH
We stumbled upon the following problems:
Stores in Zed-Backend:
During setup (docker sdk), all 3 stores from stores.php
are written in both DBs into spy_store
. Therefore, in Zed-Backend for Store 1/Store 2 I can also assign e.g. products to Store 3 and vice versa. This is highly miss leading, as Store 3 has no connection the DB used by Store 1/Store 2
Missing locales during P&S:
When publishing ProductAbstract, errors occur in \Spryker\Zed\ProductPageSearch\Business\Publisher\ProductAbstractPagePublisher::hydrateProductAbstractLocalizedEntitiesWithProductCategories
because $productAbstractLocalizedEntities
is empty. $productAbstractLocalizedEntities
is build in \Spryker\Zed\ProductPageSearch\Business\Publisher\ProductAbstractPagePublisher::findProductAbstractLocalizedEntities
, where all stores (from stores.php) are iterated and entities matching the iterated store's locales are searched. As the locales between Store 1/Store 2 and Store 3 are different, no products with locale de_DE are present in the DB of Store 3 and no products with locale de_CH, fr_CH or it_CH are present in the DB of Store 1/Store 2.
As all three stores share the same codebase (and therefore the stores.php
), is there a possibility to fix/work around the depicted problems?
Many thanks for your help.
Comments
-
I think the 2nd issue is a result of the 1st one. @ULYHPR789 could you please reveal if weβve had a similar issue on one of our recent projects and if yes - what was the solution there?
0 -
It is all about data import and stores.php.
- Data import is easiest one: you can always run different data imports processes for different databases. We have this in the next demoshops release, as example, docker.yml:
demodata: import-demodata: command: "vendor/bin/console data:import --config=data/import/local/full_${SPRYKER_REGION}.yml"
Latest Docker SDK provides SPRYKER_REGION env variable base on deploy.yml.
stores.php - thatβs tricky part. We have a huge feature in backlog that makes stores dynamic, however it is far from be done. As a workaround we propose to have logic on stores.php (it is a part of the next demoshops release too):
$stores = []; if (!empty(getenv('SPRYKER_ACTIVE_STORES'))) { $activeStores = array_map('trim', explode(',', getenv('SPRYKER_ACTIVE_STORES'))); ....
Latest Docker SDK provides SPRYKER_ACTIVE_STORES env variable base on current region and deploy.yml.
0 -
Thanks for your reply and the suggestions to work around the problems, but I've still got some questions.
Regarding topic 1: when I look at
\Pyz\Zed\DataImport\Business\DataImportBusinessFactory::createStoreImporter
in current shop suite, import data is revealed (in the end) fromstores.php
. So how would a region specific import.yml help here?Regarding topic 2: I'm on Version 1.18.3 (origin/master) of spryker/docker-sdk but can't find SPRYKER_ACTIVE_STORES in the code or the output of
export
in CLI container. Is the version you mentioned already released?0 -
- Stores.php will take only active stores based on SPRYKER_ACTIVE_STORES.
- Sorry, I miss-led you. I have that implemented in my head only. π
So there are 2 options:
A. different deploy.ymls per database.
Have this in deploy.yml.
image: tag: spryker/php:7.3-alpine3.12 environment: SPRYKER_DEFAULT_STORE: "DE" SPRYKER_ACTIVE_STORES: "DE,AT"
config/Shared/default_store.php
return getenv('SPRYKER_DEFAULT_STORE') ?: 'DE';
config/Shared/stores.php
$stores = []; if (!empty(getenv('SPRYKER_ACTIVE_STORES'))) { $activeStores = array_map('trim', explode(',', getenv('SPRYKER_ACTIVE_STORES'))); ....
B. Based on SPRYKER_REGION
config/Shared/default_store.phpreturn getenv('SPRYKER_REGION') === 'US' ? 'US' : 'DE';
config/Shared/stores.php
$stores = []; if (!empty(getenv('SPRYKER_REGION'))) { $activeStores = ['EU' => ['DE', 'AT'], 'US' => ['US']][getenv('SPRYKER_REGION')]; ....
0 -
As you see it is workarounds. No straight way for now. We are still considering having SPRYKER_ACTIVE_STORES in DSDK
0 -
Thank you for clarification. I'll have a look how to transfer this to our project.
0
Categories
- All Categories
- 42 Getting Started & Guidelines
- 7 Getting Started in the Community
- 8 Additional Resources
- 7 Community Ideas and Feedback
- 76 Spryker News
- 929 Developer Corner
- 787 Spryker Development
- 89 Spryker Dev Environment
- 362 Spryker Releases
- 3 Oryx frontend framework
- 35 Propel ORM
- 68 Community Projects
- 3 Community Ideation Board
- 30 Hackathon
- 3 PHP Bridge
- 6 Gacela Project
- 26 Job Opportunities
- 3.2K π Slack Archives
- 116 Academy
- 5 Business Users
- 370 Docker
- 551 Slack General
- 2K Help
- 75 Knowledge Sharing
- 6 Random Stuff
- 4 Code Testing
- 32 Product & Business Questions
- 70 Spryker Safari Questions
- 50 Random