Fix URL encoding for product tags in OpenCart 3#14256
Merged
mhcwebdesign merged 1 commit intoopencart:3.0.x.xfrom Dec 5, 2024
Merged
Fix URL encoding for product tags in OpenCart 3#14256mhcwebdesign merged 1 commit intoopencart:3.0.x.xfrom
mhcwebdesign merged 1 commit intoopencart:3.0.x.xfrom
Conversation
Changed the URL generation for product tags to ensure proper handling of special characters, such as ampersands (&). Used `rawurlencode()` with `html_entity_decode()` to address issues with HTML entity encoding and ensure full compatibility with URL encoding standards.
Contributor
|
Thanks for this bugfix. |
Contributor
|
This doesn't completely fix the issue. You need to also change the encoding on the breadcrumb links, etc. Maybe also use urlencode to be consistent with the links generated on the search page. |
Author
|
Ah, yeah good catch on the breadcrumbs. I used rawurlencode instead of urlencode since it encodes spaces at %20 instead of + because %20 was how the spaces were in the url before the fix. I don't think it technically matters which way though since it's in the query. |
Contributor
|
@ADDCreative : You are right for these other links, e.g. breadcrumbs etc. Just updated and tested it, see #14257 . Was going for urlencode, as that's what is used in most cases in OpenCart. According to the W3C, both '+' or '%20' are valid for URL encoding. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue
Product tags with special characters (e.g.,
&, spaces) were not properly encoded, causing broken phrasesFix
Updated the product controller to use rawurlencode() and html_entity_decode() to handle special characters and HTML entities correctly.
File Modified
Testing
&, spaces, etc.) and verified correct URL encoding.Gas & Oilnow generatestag=Gas%20%26%20Oil.https://www.carguygarage.com/index.php?route=product/search&tag=Gas%20%26%20Oil