Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean scope code resolver when starting environment emulation #857

Merged

Conversation

unicoder88
Copy link
Contributor

Summary

Hi! We came upon a problem with custom uploaded image placeholders in different store views - their configuration is not visible for stores other than first.

Steps to reproduce:

  1. Add a product without an image
  2. Go to Stores > Configuration > Catalog > Catalog
  3. Switch scope to non-default store view (e.g. second in the list)
  4. Upload custom images in Product Image Placeholders section
  5. Reindex Algolia, e.g. single product by SKU - Stores > Algolia > Reindex SKU

Expected: custom image placeholder in Algolia search for this product.
Actual: default image placeholder.

After debug, problem is in ScopeCodeResolver.

  1. Algolia iterates stores: 1 (default store)
  2. ScopeCodeResolver resolves and caches current store to store 1.
  3. Algolia iterates stores: 2 (non-default store with custom placeholder)
  4. ScopeCodeResolver resolves cached current store to store 1 - here's an error. It fails to pick up that we are emulating store 2 this time.
  5. Placeholder asset reads configuration using incorrectly resolved store ID, always returning placeholder for first store in the list.

Please have a look :)

@bsuravech bsuravech added this to the 1.12.1 milestone Oct 9, 2019
@damcou damcou self-requested a review October 10, 2019 13:02
Copy link
Contributor

@damcou damcou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your PR @unicoder88 !
I checked and indeed, there was an issue with placeholders set on store view.
Seems to be fixed with your changes.

@damcou damcou merged commit 3070d16 into algolia:develop Oct 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants