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

Fixes ALP facets for multiple stores #116

Merged
merged 4 commits into from
Dec 5, 2023
Merged

Fixes ALP facets for multiple stores #116

merged 4 commits into from
Dec 5, 2023

Conversation

ah-net
Copy link
Collaborator

@ah-net ah-net commented Nov 14, 2023

When you have multiple tweakwise instances (per store) only the facets of the first instance get returned. This pull request fixes that and returns the facets/facetattributes of all the stores.

It also checks which filtertemplate is selected. So it only returns attributes for that filtertemplate.

Copy link

@umizoomi umizoomi left a comment

Choose a reason for hiding this comment

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

I am not sure how this is suppose to work. But for the project I am reviewing this code for, the returned Filter Attributes don't seem to match what is visible in the Tweakwise backend
stores_missing_attributes

@ah-net
Copy link
Collaborator Author

ah-net commented Nov 21, 2023

@umizoomi Dit you test this in combination with EmicoEcommerce/Magento2AttributeLandingTweakwise#15

That pull request is also necessary to test this because it adds the template id to the request.

@umizoomi
Copy link

@ah-net Yes I did.

In the screenshot posted earlier, you can see the id "8" in the console. Also on the left side in the Tweakwise backend.

I can do a double check later on. Are there additional things I can/should check?

@ah-net
Copy link
Collaborator Author

ah-net commented Nov 21, 2023

@umizoomi Weird, that's all you should need. I'll test it on my end again. Do you use one TW instance or multiple? (for different stores)

@umizoomi
Copy link

@ah-net Its 5 different stores on one TW instance. Each store has its own "Root > Store" category within Tweakwise

@ah-net
Copy link
Collaborator Author

ah-net commented Nov 21, 2023

@umizoomi Which category did you select? The results are filtered based on the selected category.

I'll do an test with your instance and see if i can reproduce the problem.

@umizoomi
Copy link

umizoomi commented Nov 21, 2023

@ah-net That is the root category of the store. In the case of the project I tested this on, all the store's use the same root category.

Looking at the Attribute Landing admin page. The "Category" select element lists the category tree for the default store. As no store parameter is passed when loading the Attribute Landing admin page. As seen in Emico\AttributeLanding\Ui\Component\Product\Form\Categories\Options

Then there's a multiselect "Active stores" with all the available store scopes.

The root category assignment can differ for each website, and thus store scope. So perhaps this is something that needs attention.

@ah-net
Copy link
Collaborator Author

ah-net commented Nov 22, 2023

@umizoomi I think i found the problem.

The category does indeed cause problems because there isn't an overlapping root category from magento in TW (only the default TW root). I'll fix this by removing the category filter on the result.

The main problem seems to be that 'show filter' is off on the missing filters. The TW api doesn't return those filters. The other missing filters are caused by the filter type. I'll check if we can add support for all filter types.

But I'll discuss the problem with 'show filter' internally, because I can't show the filters that are not returned by the api.

@ah-net
Copy link
Collaborator Author

ah-net commented Nov 29, 2023

@umizoomi Unfortunately we can't add the filters with "show filter off" to the api response anytime soon (or maybe not at all). So we are going to add an 'other' option to the dropdown that lets you add an filter in an text field. So you can manually add an filter if it's missing from the select.

@umizoomi
Copy link

I see. So for my clarification.

When filling in an attribute to filter on for the attribute landing page, and that filter attribute is marked as "show filter = off" in TW. It will still be used as a filter to retrieve the products for the attribute landing page?

And as previously. When an attribute is entered that is not in the filter template. It will have no effect. Is that correct?

@ah-net
Copy link
Collaborator Author

ah-net commented Dec 5, 2023

@umizoomi Correct. If the filter is marked as "show filter" is of. It will not be in the dropdown. But you can add it by selecting 'other' and adding it manually. And it wil be used to retrieve the products for the ALP. (if spelled correctly)

And if the attribute is not available (or spelled incorrectly) it doesn't do anything.

@ah-net ah-net merged commit 9ac53f8 into master Dec 5, 2023
@ah-net ah-net deleted the bugfix-facets-ALP branch December 5, 2023 14:32
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.

2 participants