VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: sandomatyas on November 01, 2017, 05:20:20 AM

Title: Comma in alias
Post by: sandomatyas on November 01, 2017, 05:20:20 AM
When I create new categories VM 3.2.4 doesn't remove commas from the alias field which breaks my urls.
Title: Re: Comma in alias
Post by: sandomatyas on July 26, 2018, 15:18:12 PM
It's still in 3.2.14
Title: Re: Comma in alias
Post by: Milbo on July 29, 2018, 22:06:17 PM
commas do not break urls!
Title: Re: Comma in alias
Post by: Jörgen on July 29, 2018, 23:46:16 PM
Yes, commas are allowed in urls but they can make them look visually strange. Although allowed, there is good reason to stay away from commas. Perhaps they should be translated to '-'. Or you could simply not use commas in categories and product names? I have no definite solution to this.
Jörgen @ Kreativ Fotografi
Title: Re: Comma in alias
Post by: Milbo on August 02, 2018, 11:27:33 AM
or we add a VmConfig
Title: Re: Comma in alias
Post by: Jörgen on August 02, 2018, 11:28:25 AM
Sounds like a good idea :)
Jörgen @ Kreativ Fotografi
Title: Re: Comma in alias
Post by: sandomatyas on August 13, 2018, 14:09:01 PM
Quote from: Milbo on August 02, 2018, 11:27:33 AM
or we add a VmConfig

Simple, elegant, powerful. I like it :)
Title: Re: Comma in alias
Post by: Ventsi Genchev on February 25, 2019, 09:21:33 AM
This problem continues to exist. If you put a comma in the name of the product, it does not transform into a dash.

Do I miss something or still have no solution?
Title: Re: Comma in alias
Post by: beny.rfg on March 22, 2019, 23:58:20 PM
Hi there,

I have the same problem, how can I fix it? Moreover, if I together set in virtuemart.cfg "transliterateSlugs=1" (because I need remove diacritics from url), comma is replaced to "%2C" and product url is crashed (404).

1. original alias: /bio-kapsička-jablko,-karotka-ovko-90-g
2. with "transliterateSlugs=1": /bio-kapsicka-jablko%2C-karotka-ovko-90-g,
3. I need this: /bio-kapsicka-jablko-karotka-ovko-90-g

Thanks, Petr
Title: Re: Comma in alias
Post by: diri on March 23, 2019, 05:09:18 AM
@benny.rfg:

Please give a hint for me how system should be able to find the link you want to see when somebody clicks instead of real link you typed (with comma).

For me it look like you want a third stage for having a second alias.

Currently it has two stages only:
1. real name
2. alias

You want:
3. alias of alias

Or, did I get it wrong?

Title: Re: Comma in alias
Post by: beny.rfg on March 23, 2019, 11:29:23 AM
Hi Diri,

no, i just want to remove commas from the URLs.

Instead this: /bio-kapsicka-jablko,-karotka,-banan-ovko-90-g-detail I need this: /bio-kapsicka-jablko-karotka-banan-ovko-90-g-detail

Thanks, Petr
Title: Re: Comma in alias
Post by: diri on March 28, 2019, 14:14:25 PM
One can edit alias.

What about deleting comma there?
Title: Re: Comma in alias
Post by: Jenny2025 on April 01, 2019, 12:04:09 PM
Confirm. I have the same problem with my sites.
Every time I edit in the Virtuemart code to fix it.

Apparently this happened after virtuemart switched to its transliteration, abandoning the standard Joomla transliteration.
Transliteration Joomla works perfectly, such problems with the categories/content of Joomla is not observed.

This problem is not new. Here is a link to the 2014 article on the solution we have to use when creating a new Virtuemart store https://jdevelop.info/articles/joomla-extensions/420-net-transliteratsii-v-virtuemart-2-6-6
My sites use russian language (ru-RU).
The problem occurs when you enable transliteration in Virtuemart settings (thank you for taking this option to settings).

Problem with symbols:

, - replaced by %2C. Comma can be removed when forming an alias;

ъ - when creating a category/product with this letter, it is replaced by the characters %D1%8A. The letter ъ can be removed when forming an alias;

Category/product on the site does not open because of the % symbol. % breaks the link.
When you re-save the category/product % is deleted, the letters are converted to lowercase. It turns out like this d1-8a.

" - commas. This problem is not of transleithania, and the field category name/product. When you create a category/product with quotes, for example, Набор кастрюль "Ромашки", the alias is generated correct nabor-kastryul-romashki, but in the category/product name field only Набор кастрюль is displayed, and if you save, then this name will be saved and the site will be displayed as Набор кастрюль, and Ромашки is already hopelessly lost.

Link to the decision http://virtuemart.su/forums/topic/obrezaet-nazvanie-kategorii-posle/

/administrator/components/com_virtuemart/views/product/tmpl/product_edit_information.php
<input class="required inputbox" type="text" name="product_name" id="product_name" value="<?php echo htmlspecialchars($this->product->product_name); ?>" size="32" maxlength="255" />

/administrator/components/com_virtuemart/views/category/tmpl/edit_categoryform.php
<?php echo VmHTML::row('raw','COM_VIRTUEMART_CATEGORY_NAME',VmHtml::input('category_name',htmlspecialchars($this->category->category_name),'class="required inputbox"').$this->origLang); ?>

Please tell me how we can solve this problem once and for all?
Excuse me for my English.
Title: Re: Comma in alias
Post by: Milbo on April 10, 2019, 09:20:40 AM
Quote from: Jenny2025 on April 01, 2019, 12:04:09 PM
Apparently this happened after virtuemart switched to its transliteration, abandoning the standard Joomla transliteration.
Transliteration Joomla works perfectly, such problems with the categories/content of Joomla is not observed.

Transliterate slugs just enables the joomla standard transliteration!

$unicodeslugs = VmConfig::get('transliterateSlugs',false);
if($unicodeslugs){
$lang = vmLanguage::getLanguage();
$this->$slugName = $lang->transliterate($this->$slugName);
}


$lang is just the normal joomla language.

What you do is using two settings which do not work together. In joomla you have a configuration setting for the URLS, check your SEO settings and there is a setting called "Unicode Aliases" and these setting creates your % and then you have transliterateSlugs enabled, that does not work as you explained yourself perfectly
Title: Re: Comma in alias
Post by: Jenny2025 on April 30, 2019, 12:40:00 PM
Quote from: Milbo on April 10, 2019, 09:20:40 AM
Quote from: Jenny2025 on April 01, 2019, 12:04:09 PM
Apparently this happened after virtuemart switched to its transliteration, abandoning the standard Joomla transliteration.
Transliteration Joomla works perfectly, such problems with the categories/content of Joomla is not observed.

Transliterate slugs just enables the joomla standard transliteration!

$unicodeslugs = VmConfig::get('transliterateSlugs',false);
if($unicodeslugs){
$lang = vmLanguage::getLanguage();
$this->$slugName = $lang->transliterate($this->$slugName);
}


$lang is just the normal joomla language.

What you do is using two settings which do not work together. In joomla you have a configuration setting for the URLS, check your SEO settings and there is a setting called "Unicode Aliases" and these setting creates your % and then you have transliterateSlugs enabled, that does not work as you explained yourself perfectly


We do not use Unicode in url. This is bad for SEO and links look ugly when you share a link.
We use url with Latin letters.
An example of a category http://krai.user2065992.atservers.net/katalog/obogrevateli-na-solyarke-i-kerosine


1. I installed the latest version of Joomla
I do nothing, just create article in the "Content - Articles".
The subject article of this set: Запятая , ТверSPAMый знак ъ и кавычки " - наши лучшие SPAMрузья
Save article.
Joomla forms an alias: zapyataya-tverdyj-znak-i-kavychki-nashi-luchshie-druzya

Perfect! Clean and no extra characters. The comma and the letter "ъ" have been deleted.


2. I am installing the latest version of Virtuemart.
Do not do anything, just create a product in Virtuemart.
Name of product ask such same: Запятая , ТверSPAMый знак ъ и кавычки " - наши лучшие SPAMрузья
Save product.
Virtuemart forms an alias: запятая-,-тверSPAMый-знак-ъ-и-кавычки-наши-лучшие-SPAMрузья
https://yadi.sk/i/KBR0FMgmJEV9TA

Cyrillic... It seems that everything looks not bad, but it needs to be like this: "zapyataya-tverdyj-znak-i-kavychki-nashi-luchshie-druzya".

Output to the main Virtuemart, check how the product opens.
http://slugs/index.php/%D0%B7%D0%B0%D0%BF%D1%8F%D1%82%D0%B0%D1%8F-,-%D1%82%D0%B2%D0%B5%D1%80%D0%B4%D1%8B%D0%B9-%D0%B7%D0%BD%D0%B0%D0%BA-%D1%8A-%D0%B8-%D0%BA%D0%B0%D0%B2%D1%8B%D1%87%D0%BA%D0%B8-%D0%BD%D0%B0%D1%88%D0%B8-%D0%BB%D1%83%D1%87%D1%88%D0%B8%D0%B5-%D0%B4%D1%80%D1%83%D0%B7%D1%8C%D1%8F-detail
Comma really does not break the link and the product successfully breaks away. But just look at this link! It's awful! That's why we do not use Cyrillic in the url.

3. Go to Virtuemart settings and in the tab SEO enable "Transliterate slugs".
Save the settings, and create a product with the same name: Запятая , ТверSPAMый знак ъ и кавычки " - наши лучшие SPAMрузья
Virtuemart enabled setting "Transliterate slugs" forms an alias: zapyataya-%2C-tverdyj-znak-%D1%8A-i-kavychki-nashi-luchshie-druzya
https://yadi.sk/i/qwbUsdQiXzEpnA

Go to the site, trying to go to the product page, the link he has this:
http://slugs/index.php/zapyataya-%2C-tverdyj-znak-%D1%8A-i-kavychki-nashi-luchshie-druzya-1-detail
But we stay on the category page and the message is displayed "404 The requested product does not exist."
https://yadi.sk/i/v9x1I4aA-MOoFQ

You see this? %2C %D1%8A - they break the link!
Settings Joomla and Virtuemart
https://yadi.sk/i/1vOLoXOgDdE6tg
https://yadi.sk/i/9ghYy4GvksD9BQ

_____________________________________

Result:
Quotes in the product name are no longer a problem. Thank you!  :)
The problem will remain in the category name https://yadi.sk/i/xeYmWKKNiPlfnQ. Here is an example where quotes are used in the category name http://krai.user2065992.atservers.net/katalog/zapchasti

Cyrillic in the url most do not use, because it is not beautiful.
In Joomla articles default transliteration to the Latin alphabet, comma and "ъ" are cut from the alias.

Example of search results in Google on request "купить SPAMрель" ("buy a drill")
https://www.google.by/search?q=%D0%BA%D1%83%D0%BF%D0%B8%D1%82%D1%8C+%D0%B4%D1%80%D0%B5%D0%BB%D1%8C&hl=ru&ei=BRvIXKrsMOjCrgSn8YPgDQ&start=0&sa=N&ved=0ahUKEwjqgtXyxffhAhVooYsKHaf4ANw4ChDy0wMIhQE&biw=1920&bih=937
On the first two pages of any website who would use Cyrillic in the url, only Latin.

Sincerely, Jenny
Title: Re: Comma in alias
Post by: d0ublezer0 on May 30, 2019, 08:57:19 AM
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?
Title: Re: Comma in alias
Post by: shyntaxx on June 24, 2021, 15:55:13 PM
I wonder if there is a solution to this?
Title: Re: Comma in alias
Post by: 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});

Title: Re: Comma in alias
Post by: Rune Rasmussen on March 03, 2022, 10:17:48 AM
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.
Title: Re: Comma in alias
Post by: Kuubs on April 05, 2022, 15:01:02 PM
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?