News:

Looking for documentation? Take a look on our wiki

Main Menu

Comma in alias

Started by sandomatyas, November 01, 2017, 05:20:20 AM

Previous topic - Next topic

d0ublezer0

#15
QuoteYou see this? %2C %D1%8A - they break the link!
Settings Joomla and Virtuemart
https://yadi.sk/i/1vOLoXOgDdE6tg
https://yadi.sk/i/9ghYy4GvksD9BQ
Confirm: %2C and %D1%8A in product urls raises 404 error, when you try to visit them.
Vm 3.4.5
Transliterate slugs - enabled.

Create sample product with comma in product name: "sample product, test", save it
Get product alias "sample-product%2C-test".
Do nothing, just save it again.
Then you're get normal alias "sample-product-2c-test"
Why i need to do double-saving for normal alias?
At second saving Joomla understands, that percent symbol is not suitable for urls, so it must be removed.

Will it be fixed?

shyntaxx

I wonder if there is a solution to this?

drejk

Solution is to slightly modify a line in administrator/components/com_virtuemart/helpers/vmtable.php:

a) comment out line aroud line 1570 (add // in front) - this fixes links (this line shouldn't be there anyways. Btw. "$unicodeslugs" is practically the opposite of what it is called - it should be called "$transliterate" )
   //if($unicodeslugs)$this->{$slugName} = rawurlencode($this->{$slugName});

b) optional - if you want only alphanumeric characters, dashes and underscores add at next line
       $this->{$slugName} = preg_replace('~[^-a-z0-9_]+~', '', $this->{$slugName});


Rune Rasmussen

Sorry to jump in on this, but ...

Quote from: Milbo on July 29, 2018, 22:06:17 PM
commas do not break urls!

The question still is if it's any good reasons for keeping it like that, when it's a easy fix to it, improving the look and avoiding confusion. VM probably is the only system where I have seen this behaviour, so quite unusual.
Rune Rasmussen - https://www.syntaxerror.no/

Norwegian Translation Team

Kuubs

Quote from: drejk on December 09, 2021, 11:03:29 AM
Solution is to slightly modify a line in administrator/components/com_virtuemart/helpers/vmtable.php:

a) comment out line aroud line 1570 (add // in front) - this fixes links (this line shouldn't be there anyways. Btw. "$unicodeslugs" is practically the opposite of what it is called - it should be called "$transliterate" )
   //if($unicodeslugs)$this->{$slugName} = rawurlencode($this->{$slugName});

b) optional - if you want only alphanumeric characters, dashes and underscores add at next line
       $this->{$slugName} = preg_replace('~[^-a-z0-9_]+~', '', $this->{$slugName});

Maybe submit this code to the core? So it gets changed?

sandomatyas

Hello guys, no change in topic since 2017? :/