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

Incorrect Category URLs in Search Suggestions Leading to 404 Errors in Magento 2 with Smile ElasticSuite #3412

Closed
adriyanj0 opened this issue Oct 16, 2024 · 1 comment

Comments

@adriyanj0
Copy link

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

@romainruaud
Copy link
Collaborator

Duplicate of #3384 which you already created.

Your issue will be taken into account, no worries, please don't create a duplicated one.

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

No branches or pull requests

2 participants