Adding a Subpart
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!
Re: Adding a Subpart
Got it! I had a typo in the manifest file. Lesson learned: use the extension generator you guys provide
Now to figure out how to show products in subcategories when viewing the parent category.
Basically, if I'm in Category1 (which has subs of Subcategory1 and Subcategory2), I want to be able to see all the products in the tree from the top of the tree. If I drill down to Subcategory1, I only want to see those products and not any in the parent or sibling subs.
Now to figure out how to show products in subcategories when viewing the parent category.
Basically, if I'm in Category1 (which has subs of Subcategory1 and Subcategory2), I want to be able to see all the products in the tree from the top of the tree. If I drill down to Subcategory1, I only want to see those products and not any in the parent or sibling subs.
Re: Adding a Subpart
Yep, that helpsswpierce wrote:Got it! I had a typo in the manifest file. Lesson learned: use the extension generator you guys provide
Use this method to retrieve the products by category/categories:swpierce wrote: Basically, if I'm in Category1 (which has subs of Subcategory1 and Subcategory2), I want to be able to see all the products in the tree from the top of the tree. If I drill down to Subcategory1, I only want to see those products and not any in the parent or sibling subs.
https://github.com/aimeos/aimeos-core/b ... t.php#L186
Here is an example how it's used:
https://github.com/aimeos/aimeos-core/b ... t.php#L364
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: Adding a Subpart
As I'm looking at where to put the code for this (displaying products from subcategories in parent category list), I'm thinking a Decorator would be best option?
I don't really want to write another layout. I want to use the current catalog list layout. I just need to inject additional information before the view is rendered.
My thought is a Decorator applied to Html\Catalog\List\Default - in the Decorator, I can do something like:
Does that make any sense at all? The sun isn't up and I haven't had my coffee yet so I might not be thinking clearly yet this morning. Is there an easier way?
I don't really want to write another layout. I want to use the current catalog list layout. I just need to inject additional information before the view is rendered.
My thought is a Decorator applied to Html\Catalog\List\Default - in the Decorator, I can do something like:
Code: Select all
$topCatId = $view->listCurrentCatItem->getId();
// perform search where catalog.parentid == topCatId to get list of children categories
// (or would doing something like catalogController->getCatalogPath($topCatId, $domains) be better?
// build an array of catalog IDs from the list we just pulled
$childIDs = .....;
// get a product controller and do a search where product.parentid in $childIDs
$productList = .....;
// merge the new product list with the product list set by Html\Catalog\List\Default
$currentCatProds = $view->listProductItems;
// $view->listProductItems = ($currentCatProds merged with $productList)
Re: Adding a Subpart
Good morning
Decorators are cool and I think you can do it that way if you need a merged list of products from parent and child categories. But what about simply assigning the products from the child categories also to the parent category in the admin interface (or during the product import)? Seems to me a more elegant way and you additionally have full control over the product order in the list.swpierce wrote:As I'm looking at where to put the code for this (displaying products from subcategories in parent category list), I'm thinking a Decorator would be best option?
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: Adding a Subpart
Now that is a WAY better idea AND I don't have to write any code. Thanks!!