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

Search suggestion leads to 404 page (Not using correct URL) #3384

Open
adriyanj0 opened this issue Sep 16, 2024 · 0 comments
Open

Search suggestion leads to 404 page (Not using correct URL) #3384

adriyanj0 opened this issue Sep 16, 2024 · 0 comments
Assignees
Labels

Comments

@adriyanj0
Copy link

adriyanj0 commented Sep 16, 2024

Hello,

We are developing Magento 2 store, where we use the module Smile ElasticSuite.

We are facing an issue using the search bar. When i type a result, there are category suggestions, which have to redirect to the exact category. The problem is that, for plenty of categories the redirect leads to 404 page. We analyzed the issue and saw that the url, to which the suggestion redirects, is wrong. As wee see the url contains global url, even though we open it from a suggestion on a specific store view.

Moreover, we checked the code and found something, which may be the conundrum:

$documentSource = $category->getDocumentSource();
if ($documentSource && isset($documentSource['url_path'])) {
    $urlPath = is_array($documentSource['url_path']) ? current($documentSource['url_path']) : $documentSource['url_path'];
    return trim($this->urlBuilder->getDirectUrl($urlPath), '/') . $this->categoryUrlSuffix;

We see that, these code makes a check, from which it gets the "url_path", which is the problem from our opinion, because if there is no check the code which is gonna be executed is $category->getUrl(), which responds with the correct URL and the problem is not happening.

Magento version: 2.4.6-p6
Elastic Suite version: 2.11.8.3
Magento websites: Currently 4-5 websites

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants