-
Notifications
You must be signed in to change notification settings - Fork 116
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
Fix replace categories when categories are not set as attribute for f… #650
Conversation
…aceting. This sets categories attribute as attribute for faceting automatically.
thanks,
PS upgrading to 1.7.2 will make ones credentials incorrect (on any config change i.e. save?) as it seems:
So integration will fail with ERROR Credentials not configured correctly unless you manually re-fill config details in Magento. |
Thanks for info @dmytro-butko, I added the not about Admin API key to release notes - https://github.com/algolia/algoliasearch-magento/releases/tag/1.7.2 |
@@ -119,15 +130,17 @@ if ($config->isInstantEnabled()) { | |||
$isSearchPage = true; | |||
} | |||
|
|||
foreach ($facets as $facet) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about something like that:
array_in('categories', array_map(function ($facet) {
return ($facet['attribute']);
}, $facets);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about it as it's harder to read and I had to think for a while what your code does.
And it would be less efficient as it'd always iterate through all $facets
and then again until it finds the correct attribute.
@@ -75,6 +75,13 @@ document.addEventListener("DOMContentLoaded", function (event) { | |||
if (algoliaConfig.request.refinementKey.length > 0) { | |||
data.helper.toggleRefine(algoliaConfig.request.refinementKey, algoliaConfig.request.refinementValue); | |||
} | |||
|
|||
if (algoliaConfig.areCategoriesInFacets === false && algoliaConfig.request.path.length > 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure to get this part
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need to set the refinement only when categories widget does not exists and the user is on category page. Otherwise it breaks down categories hierarchical widget.
…aceting. This sets categories attribute as attribute for faceting automatically.