Page 1 of 1

URL sanatize with "-" instead of "_"

Posted: 23 Aug 2016, 16:59
by andreas.allacher
Hi,

I just want to know if there is a simple way to have the product names etc. sanitized with "-" instead of "_"

If I am correct what will work is to set:
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['aimeos']['aimeos_view_url']

Copy the Method:
\Aimeos\Aimeos\Base\View::addUrl

without the callable check and replace \Aimeos\MW\View\Helper\Url\T3Cli
and \Aimeos\MW\View\Helper\Url\Typo3
with my own classes that extend the original and add a own sanatize method that
is a copy of the method from \Aimeos\MW\View\Helper\Url\Base
but in preg_replace it replaces the "_" instead with "-".
i am asking because:
1.) I think it looks better :)
2.) realurl is by default using "-" and with 2.0.x the parameter to modify it has become deprecated, so it would be better to use the same sanatize parameter as realurl does.

Is there a simpler solution?
If not, is there a possibility that I might run intro troubles when using "-" instead of "_"?

I guess it would always work correctly for "d_name" and "f_name" as those are optional parameters but what about those that set the $all parameter?

In that regard: I noticed an issue with the realurl autoconfiguration:

Code: Select all

		'co' => array(
						array( 'GETvar' => 'ai[c_step]' ),
						array( 'GETvar' => 'code' ),
						array( 'GETvar' => 'orderid' ),
					),
The parameter ai[c_step] is not set always, e.g. on the payment success url which results in "..//.." being used, however that might not be transferred correctly by the payment provider etc. so I think this parameter should be split instead.

Re: URL sanatize with "-" instead of "_"

Posted: 25 Aug 2016, 11:08
by aimeos
If you add a product text with type "url" (or fill the "URL segment" field in the simple mode admin interface), you can define how the product names are displayed in the URL.

Regarding ai[c_step]: Yes, your are right, that should be split.
Could you create a Github PR which creates a realurl config for /checkout/confirm as "cc" only with code and orderid?

Re: URL sanatize with "-" instead of "_"

Posted: 25 Aug 2016, 11:17
by andreas.allacher
OK.
But I still think there should be an option to automatically sanitize those names accordingly.

Regarding PR:
https://github.com/aimeos/aimeos-typo3/pull/14

Re: URL sanatize with "-" instead of "_"

Posted: 25 Aug 2016, 11:43
by aimeos
Sanitize URL parameters are more complex than just using "_" or "-" for some characters. Think about non-latin languages. Thus we've decided to leave this to the shop owners so they can exactly define what they want the URL to look like.

Re: URL sanatize with "-" instead of "_"

Posted: 25 Aug 2016, 11:45
by andreas.allacher
That's true, of course, but I meant the default behaviour if there is no url segement.