Skip to content

MAGE-986 Configurable no-code redirects #1740

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

Merged
merged 27 commits into from
Apr 29, 2025

Conversation

cammonro
Copy link
Contributor

Summary

This PR provides configurability for the redirect features added for both Autocomplete and InstantSearch.

  • Separate configurations provided for Autocomplete and InstantSearch as these two libraries deliver different UX
  • Redirects are enabled by default for the Autocomplete (the most sensible application) but InstantSearch can also be used
  • Autocomplete only supports redirects originating from the product index at this time
  • A conflict with the onSubmit handler was identified with the Autocomplete plugin so state was added to the Autocomplete UI component to track when redirects are retrieved on the product source
  • Added ability to open links in new windows/tabs (but clickable only because of browser popup blocker warnings)
  • A custom navigator object has been added to autocomplete.js UI component to facilitate customization / overriding of URL navigation behaviors.
  • A checkbox front end model was added to the Magento admin config to allow easier selection of multiple options on InstantSearch redirect behavior
  • Partially addressed the monolithic ConfigHelper problem by splitting out domain specific config helpers for both Autocomplete and InstantSearch
  • Factored out serialization operations into a separate Serializer service for composability and to prevent circular dependencies between helpers
  • Removed config related methods deprecated in 3.14 (introduced on 3.12)
  • Updated unit tests

Result

Autocomplete configuration
image

Redirect only on submit
image
image

Redirect with selectable menu item
image
image

Redirect with selectable menu item and matching hits
image
image

InstantSearch configuration
image

Redirect with selectable item
image

Unit tests
image

@cammonro cammonro requested a review from damcou April 24, 2025 13:37
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.

Nice job here 👏
Unit tests are passing (with a little bit of tweaking as explained in the comments) !
Also tested manually and it's also working overall.
Splitting the ConfigHelper makes definitely a lot of sense, very good initiative !

@cammonro cammonro requested a review from damcou April 29, 2025 02:25
@cammonro cammonro force-pushed the feat/MAGE-986-no-code-redirect-config branch from f81a47b to 5fbac83 Compare April 29, 2025 02:51
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.

All good for me ! 🚀
Just an optional HTML change for the checkboxes if you want to, but this is good to merge as it is !

$checked ? 'checked' : ''
);
$html .= '<div class="form-content">';
$html .= sprintf('<label>%s</label>',$label ?? $name);
Copy link
Contributor

Choose a reason for hiding this comment

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

Not mandatory, but maybe we would want the label to be clickable to check the related checkbox with a for property related to an id property on the input ? Feel free to ignore if you want to move on.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a great idea and I neglected to do it. Thanks for raising it! Will amend.

@cammonro cammonro merged commit 28d72ce into release/3.16.0-dev Apr 29, 2025
3 checks passed
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