Trailing Slash for Product URL

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!
didev
Posts: 2
Joined: 15 May 2022, 11:06

Trailing Slash for Product URL

Post by didev » 15 May 2022, 11:13

Hello,

I would like to set a trailing slash to the product-urls. My config.yaml looks like this

Code: Select all

- { routePath: '/{d_prodid}-{d_pos}-{d_name}', _controller: 'Catalog::detail' }
I tried the solution for Problems with routeEnhancers and Slash PageTypeSuffix but it didn't worked.
Also played around with something like this

Code: Select all

- { routePath: '/{d_prodid}-{d_pos}-{d_name}/', _controller: 'Catalog::detail' }
and

Code: Select all

    
    default: /
    suffix: /
    index: /
    map:
      /: 0
      stock: 191351524
      
Also tried with

Code: Select all

return $this->view->url($detailTarget, $detailController, $detailAction, $params, ['d_name' => '/'], $detailConfig);
but didn't worked either.
Do you have any suggestions whats maybe wrong with my config?

Typo3: 11.5.9
Aimeos: 21.10.5

Thanks a lot!

Regards
David

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

Re: Trailing Slash for Product URL

Post by aimeos » 16 May 2022, 06:42

That's a TYPO3 specific question you should better ask in a TYPO3 related forum.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

didev
Posts: 2
Joined: 15 May 2022, 11:06

Re: Trailing Slash for Product URL

Post by didev » 17 May 2022, 09:29

Hey thanks for your reply,

but I think it's not a TYPO3-related issue. Because if I add a "/" to the product URL I get the error message:
Item with ID "/" in "product.id" not found. So I think Aimeos checks the url after the last slash?!

If I add some other characters like "+" or "=" the url ends with that characters.

/p/123-name+ -> no problem
/p/123-name= -> no problem
/p/123-name/ -> doesnt work

If I use Aimeos\MW\View ->url(.., $trailing,...) and I add ->url(..., ['/'],...) the url looks like this
/p/123-name#/ -> no problem

why I cant use the ->url() method without the '#' char?

Regards
David

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

Re: Trailing Slash for Product URL

Post by aimeos » 18 May 2022, 06:24

Your configured route path is "/{d_prodid}-{d_pos}-{d_name}/". Thus, you need URLs like "/p/123-0-name/" and "/p/123-name/" can't be resolved correctly by TYPO3 (because the d_pos parameter is missing).
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply