breadcrumb modification in catalog details page

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!
User avatar
mahammadareef
Posts: 54
Joined: 14 Oct 2022, 11:54

breadcrumb modification in catalog details page

Post by mahammadareef » 21 Mar 2023, 15:05

hi, team aimeos,

I want to show the breadcrumb in catalog details page with full details like what exists on the catalog list page,
ex :
You are here: Bestsellers > Women > Dresses


if I click any item in this category and catalog details page, where breadcrumb should be like this
You are here: Best sellers > Women > Dresses > Name of the product


how i can fulfill this

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

Re: breadcrumb modification in catalog details page

Post by aimeos » 23 Mar 2023, 09:00

You can either use the attached categories to create the breadcrumb or pass the f_catid parameter to the detail view. Within a decorator (https://aimeos.org/docs/latest/frontend ... omponents/), you can then use the catalog frontend controller to get the categories for the breadcrumb in the data() method of the decorator:

Code: Select all

$catId = $view->param( 'f_catid' );
// or
$catId = $view->detailProductItem->getRefItems( 'catalog' )->getId()->first();

$path = \Aimeos\Controller\Frontend::create( $this->context(), 'catalog' )->getPath( $catId, ['text'] )->getName();
$path[] = $view->detailProductItem->getName();
$view->detailBreadcrumb = $path
In the template, you can display the path using:

Code: Select all

<?= $enc->html( join( ' > ', $this->get('detailBreadcrumb', []) ) ) ?>
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

User avatar
mahammadareef
Posts: 54
Joined: 14 Oct 2022, 11:54

Re: breadcrumb modification in catalog details page

Post by mahammadareef » 24 Mar 2023, 04:45

i wanted to get this and display this

Code: Select all

$this->get('detailBreadcrumb', []) )
inside catalog/stage component

I created a decorator for the product detail component and everything is fine

Code: Select all

 $catId = $view->detailProductItem->getRefItems( 'catalog' )->getId()->first();

by using this code I can get the first category of the product tats okay, but how i can pass this value or get this value in catalog stage component because $view->detailProductItem not available inside of stage component

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

Re: breadcrumb modification in catalog details page

Post by aimeos » 27 Mar 2023, 17:08

The breadcrumb on the catalog detail page is added here:
https://github.com/aimeos/ai-client-htm ... dy.php#L57

Here's the code which creates it:
- https://github.com/aimeos/ai-client-htm ... #L193-L204
- https://github.com/aimeos/ai-client-htm ... #L324-L385

In the catalog list page, the breadcrumb is generated by the catalog/stage component:
https://github.com/aimeos/ai-client-htm ... hp#L30-L76

In the catalog/stage component used at the catalog list page you don't have access to the product item because there's none (obviously).
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply