Duplication of product URL segment is a problem

Help for integrating the Laravel package
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
akropivko
Posts: 36
Joined: 20 Jan 2021, 12:49

Duplication of product URL segment is a problem

Post by akropivko » 20 Sep 2021, 09:45

Hi!
I case I have 2 or more products with the same product name then I have the same product URL segments by default - and this is a problem, since all these products have totally the same URLs. Could you please advice what is the best way to change the default method of URL segment creation? Say I'd like to have the product's name + product's code as its URL segment. For instance,
/product_name_product_code - see the snapshot

Laravel 6.20.27
aimeos/aimeos-core 2020.10.24
PHP 7.4
Attachments
Screenshot_55.jpg
Screenshot_55.jpg (18.26 KiB) Viewed 1317 times

akropivko
Posts: 36
Joined: 20 Jan 2021, 12:49

Re: Duplication of product URL segment is a problem

Post by akropivko » 20 Sep 2021, 11:45

And when I set my custom URL using setUrl() function (for instance $item->setUrl($item->getURL() . '-' .$item->getCode()))
then on the catalog detail page there is error "No value for key "detailProductItem" found"
To fix this error I need just to save the product details page (/admin/default/jqadm/get/product/23168?lang=en) via standard Save button - and then everything's ok.
It seems the setUrl method doesn't update the mshop_index_text with new URLs.

So the question is the same: what is the correct way to update the product URL.segment value inside the code?

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

Re: Duplication of product URL segment is a problem

Post by aimeos » 20 Sep 2021, 18:58

Set this configuration to an empty array:
https://aimeos.org/docs/2021.x/config/c ... il/#filter
i.e.:

Code: Select all

'client' => [
	'html' => [
		'catalog' => [
			'detail' => [
				'filter' => []
			]
		]
	]
]
Then, the product ID is part of the URL and will be used instead of the URL segment.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply