Adding current product category in product detail view.
Forum rules
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Adding current product category in product detail view.
Is there a quick and easy way to add the product category in my detail view? Specifically in the prod_name, I have found the " $this->detailProductItem variable does not hold any reference to its category. When trying to add the current category in the Detail\Standard.php controller I tried to follow the example fround in the list\Standard.php but it seems like it relies on the search function to find the current category. Any tips on finding the product category maybe by prod_id since i have access to that already in the detail controller.......maybe have to create my own model??
Thanks for the help,
Woo
Thanks for the help,
Woo
Re: Adding current product category in product detail view.
You can use the catalog manager to find all categories your product is listed in:
Code: Select all
$catalogManager = \Aimeos\MShop\Factory::createManager( $context, 'catalog' );
$search = $catalogManager->createSearch();
$expr = [
$search->compare( '==', 'catalog.lists.refid', $prodId ),
$search->compare( '==', 'catalog.lists.domain', 'product' ),
$search->compare( '>', 'catalog.status', 0 ),
];
$search->setConditions( $search->combine( '&&', $expr ) );
$catItems = $catalogManager->searchItems( $search );
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