-
Notifications
You must be signed in to change notification settings - Fork 20
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
issue-4287 - Add validation for some pages #17
base: master
Are you sure you want to change the base?
issue-4287 - Add validation for some pages #17
Conversation
@@ -26,6 +26,10 @@ | |||
<item name="wishlist" xsi:type="string">ScandiPWA\Router\Validator\Wishlist</item> | |||
<item name="checkout" xsi:type="string">ScandiPWA\Router\Validator\AlwaysPass</item> | |||
<item name="compare" xsi:type="string">ScandiPWA\Router\Validator\AlwaysPass</item> | |||
<item name="customer" xsi:type="string">ScandiPWA\Router\Validator\AlwaysPass</item> | |||
<item name="sales" xsi:type="string">ScandiPWA\Router\Validator\AlwaysPass</item> | |||
<item name="search" xsi:type="string">ScandiPWA\Router\Validator\AlwaysPass</item> |
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.
do we want to always pass search? what if there's no results?
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.
Yea, also though about it. But since when no items found in search it actually shows not 404 I decided to stay as 200. It just says no products found.
Also just checked on magento demo and seems same results on how magento acts.
https://magento2-demo.magebit.com/catalogsearch/result/?q=testest
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.
Actually, it will be better to add this change, for consistency.
I'm not sure what is the desired behavior, though.
Earlier PWA would return 404 on PLP's on no products, and 200 if there were products.
Search behaves the same way now:
https://luma-demo.scandipwa.com/search/yoloqwe <--- 404
https://luma-demo.scandipwa.com/search/yoloqwe <-- 200
However, it looks like at some point it was changed, and now PLP's always return 200.
Then we may as well do the same for search.
However, if we do that (and it is a desired result), IMO would need to remove the 200/404 status check logic that relates to product count, as that's extra logic that wouldn't be used.
Overall -> I'd consult SEO team, what they want there, 200 or 404, and go with that on both PLP and search.
$path = trim($request->getPathInfo(), '/'); | ||
$params = explode('/', $path); | ||
|
||
if (count($params) === 1 && $params[0] === self::WISLIST_URL_KEY) { |
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 recommending to fix the param count to 1
some 3rd party extension or project customization could easily transform it to /wishlist/...whatever.
it may be safer to only check if the 0th element is WISLIST_URL_KEY
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.
see comments
Related issue(s):
Problem:
In this PR: