URL sanatize with "-" instead of "_"

Questions around the TYPO3 integration and plugins
Forum rules
Always add your TYPO3, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
andreas.allacher
Posts: 42
Joined: 15 Dec 2015, 20:32

URL sanatize with "-" instead of "_"

Post by andreas.allacher » 23 Aug 2016, 16:59

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.

User avatar
aimeos
Administrator
Posts: 7836
Joined: 01 Jan 1970, 00:00

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

Post by aimeos » 25 Aug 2016, 11:08

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?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

andreas.allacher
Posts: 42
Joined: 15 Dec 2015, 20:32

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

Post by andreas.allacher » 25 Aug 2016, 11:17

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

User avatar
aimeos
Administrator
Posts: 7836
Joined: 01 Jan 1970, 00:00

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

Post by aimeos » 25 Aug 2016, 11:43

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.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

andreas.allacher
Posts: 42
Joined: 15 Dec 2015, 20:32

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

Post by andreas.allacher » 25 Aug 2016, 11:45

That's true, of course, but I meant the default behaviour if there is no url segement.

Post Reply