Help for integrating the Laravel package
Forum rules: Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
#5221 by Ahmad
12 Dec 2017, 15:44
for example:
i have categories home > cat-1 > cat-2 > cat-3
i set cat-3 for my product category
i want 2 thing?
1- show my product even when i was in cat-2 or cat-1 or home in catalog/list page because these categories are parents of cat-3 and when product is in cat-3 so it falls into the category of the parent?
2- when i was in product detail page (catalog/detail), i want to show hierarchical categories of product for breadcrumb, so my breadcrumb gets like this: Home > Cat-1 > Cat-2 > Cat-3

How can I do those?
#5224 by aimeos
13 Dec 2017, 00:08
Ahmad wrote:1- show my product even when i was in cat-2 or cat-1 or home in catalog/list page because these categories are parents of cat-3 and when product is in cat-3 so it falls into the category of the parent?


You can adapt the behavior using this config: https://aimeos.org/docs/Configuration/Core/client/html/catalog/lists/levels

Ahmad wrote:2- when i was in product detail page (catalog/detail), i want to show hierarchical categories of product for breadcrumb, so my breadcrumb gets like this: Home > Cat-1 > Cat-2 > Cat-3


The catalog stage component renders the breadcrumb of the category you are coming from automatically.
#5229 by Ahmad
13 Dec 2017, 15:07
aimeos wrote:
The catalog stage component renders the breadcrumb of the category you are coming from automatically.


ok, if i want to render the breadcrumb from the product deepest category to home without considering category that customer coming from, like this:
in product detail page: Home > cat-1 > cat-2 > cat-3 > product-name
in cat-3 page: Home > cat-1 > cat-2 > cat-3

what should I do?
#5232 by aimeos
13 Dec 2017, 23:26
On the list page, this is already the case. There, the current category up to the root category is printed (You are here: Home / cat 1):
http://laravel.demo.aimeos.org/perf/en/EUR/list?f_name=cat-1&f_catid=3

On the detail page, the category the user is coming from is used as current category for two reasons:
- The users normally want to go back to where they are coming from and not to what you think is the main category for this product
- Products can be assigend to multiple categories and then you have to choose in some way which is the "right" one

If you want to show the breadcrumb from of your main category nevertheless, you can search for the categories the product is assigned to using the catalog lists manager (using catalog.lists.refid). Choose one of them and use the getPath() method of the catalog manager to fetch the catalog items along the root line:
https://github.com/aimeos/ai-client-html/blob/master/client/html/src/Client/Html/Catalog/Stage/Standard.php#L457