category name in the catalog detail page
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!
- GülsümAkça
- Posts: 57
- Joined: 20 Nov 2020, 13:30
category name in the catalog detail page
is it possible to get the category id or category name in the catalog/detail/body-standard.php?
thank you
thank you
Re: category name in the catalog detail page
Yes, if you add this to the configuration documented here:
https://aimeos.org/docs/2021.x/config/c ... l/#domains
Then, you can use in your template:
https://aimeos.org/docs/2021.x/config/c ... l/#domains
Code: Select all
'catalog' => [
'text',
]
Code: Select all
<?= $this->detailProductItem->getCategoryItems()->getName()->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
- GülsümAkça
- Posts: 57
- Joined: 20 Nov 2020, 13:30
Re: category name in the catalog detail page
is this working in 2020.x version?
- Attachments
-
- Screenshot_46.png (26.11 KiB) Viewed 6801 times
Re: category name in the catalog detail page
Sorry, the method is named "getCatalogItems()":
https://github.com/aimeos/aimeos-core/b ... hp#L27-L32
Fixed that in the initial reply.
https://github.com/aimeos/aimeos-core/b ... hp#L27-L32
Fixed that in the initial reply.
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
- PedroLópezAndradas
- Posts: 22
- Joined: 16 Jan 2023, 11:30
Re: category name in the catalog detail page
How this works on 2022.x?
Thanks
Thanks
Re: category name in the catalog detail page
Category references move from mshop_catalog_list to mshop_product_list table and you can now use:
Make sure, the categories are fetched by the manager with the correct domains.
Code: Select all
$product->getRefItems( 'catalog' );
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: category name in the catalog detail page
This seems to be bugged when a product is added in several categories. The path fetched by $this->detailProductItem->getRefItems( 'catalog' ) is incorrect.
Also I see no way of getting the actual category the product was accessed through and translated labels of the categories.
Also I see no way of getting the actual category the product was accessed through and translated labels of the categories.
Re: category name in the catalog detail page
I am now passing the categoryId the product was actually opened from to the detail view and am using it in my Decorator to work my way back through the category tree to get an actual, existing breadcrumb path and not just some random chaos. This was the only solution I could think of that fixes this problem.
Re: category name in the catalog detail page
Code: Select all
$this->detailProductItem->getRefItems( 'catalog' )
Only the catalog/stage component fetches the category path for creating the breadcrumb:
https://github.com/aimeos/ai-client-htm ... #L183-L240
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