How to display breadcrumb for the current product category ?
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!
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
How to display breadcrumb for the current product category ?
Laravel v9.52.10 aimeos 2023.07 php 8.1.20 Linux
Hi
How to display breadcrumb for the current product category ? It always displaying "Back" link,on single product page, instead of the category link the product belongs.
[img]http://piotrh.net/aimeos.png[/img]
Many Thanks,
Hi
How to display breadcrumb for the current product category ? It always displaying "Back" link,on single product page, instead of the category link the product belongs.
[img]http://piotrh.net/aimeos.png[/img]
Many Thanks,
Re: How to display breadcrumb for the current product category ?
If you hand over the category ID as f_catId=..., then the breadcrumb for that category will be shown. You can add the parameter in your own template which you've copied to your project-specific extension:
https://github.com/aimeos/ai-client-htm ... s.php#L158
To get the category ID use:
https://github.com/aimeos/ai-client-htm ... s.php#L158
To get the category ID use:
Code: Select all
$productItem->getRefItems( 'catalog' )->getId()->first()
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
Re: How to display breadcrumb for the current product category ?
Hi
Thank you for your reply.
I have changed the code as suggested:
$params = array_diff_key([
'd_name' => $productItem->getName('url'),
'd_prodid' => $productItem->getId(),
'd_pos' => $position !== null ? $position++ : '',
'f_catid' => $productItem->getRefItems( 'catalog' )->getId()->first()
], $detailFilter);
and my url looks like this: /pl/shop/shirt-cap/1?f_catid=1
Breadcrumbs have appeared, but also now an error appears instead of a catalog page menu with message: "A NON-RECOVERABLE ERROR OCCURED"
[img]http://piotrh.net/menu_error.png[/img]
Thank you for your reply.
I have changed the code as suggested:
$params = array_diff_key([
'd_name' => $productItem->getName('url'),
'd_prodid' => $productItem->getId(),
'd_pos' => $position !== null ? $position++ : '',
'f_catid' => $productItem->getRefItems( 'catalog' )->getId()->first()
], $detailFilter);
and my url looks like this: /pl/shop/shirt-cap/1?f_catid=1
Breadcrumbs have appeared, but also now an error appears instead of a catalog page menu with message: "A NON-RECOVERABLE ERROR OCCURED"
[img]http://piotrh.net/menu_error.png[/img]
Re: How to display breadcrumb for the current product category ?
Please have a look into the Log panel of the admin backend for error details.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
Re: How to display breadcrumb for the current product category ?
Hi !
It looks like f_catid is not enough - f_name is also required.
I changed my code to:
Now it works.
It looks like f_catid is not enough - f_name is also required.
Code: Select all
/shop/black-shirt-men/0?f_catid=1
Missing required parameter for [Route: aimeos_shop_tree] [URI: shop/f_name~f_catid/l_page?] [Missing parameter: f_name].
Code: Select all
$params = array_diff_key([
'd_name' => $productItem->getName('url'),
'd_prodid' => $productItem->getId(),
'd_pos' => $position !== null ? $position++ : '',
'f_catid' => $productItem->getRefItems('catalog')->getId()->first(),
'f_name' => $productItem->getRefItems('catalog')->getName()->first()
], $detailFilter);