How to configure and adapt Aimeos based shops as developer
Forum rules: Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
#4494 by devyk
13 Aug 2017, 17:58
I would like to display categories tree as main menu, attributes lists as right column at list page and display search field in the header section.

I see the only way to do it just by reimplementing this subparts as separate components. Is it right solution for the task or there is better method to deal with this?
#4499 by aimeos
15 Aug 2017, 08:44
The easiest way is to add the catalog filter components three times in your controller action, each with a different configuration for the subparts. In the template, you can then put the output of each component/subpart at a different place.

You should have a look at the "Page" object in the Aimeos Laravel integration to see how to instantiate components on your own:
#4504 by devyk
15 Aug 2017, 19:28
I see from your method that this components will be available for a single action only, which is not suitable for my task. I have a global header, so this components should be available on multiple pages. Overriding each action seems to be a bad solution.

I'm thinking about overriding components factory, to make it able to use some sort of aliases.
For example I can specify

client/html/alias/<alias for component>/base/<original_component>
client/html/alias/<alias for component>/override/<original_component_config_option_path>

and configure my page to use 'alias/<alias for component>'. Then the factory will figure out that alias is requested and will populate context config with alias values. After all the factory will produce original component with alias configuration.

What you think?
#4505 by devyk
15 Aug 2017, 19:54
Another possible solution is extend base component and override the getSubClientNames() method in way like this.
Component properties are private that's why more elegant solution is not possible, which is a little bit weird. (or component classes are not supposed to be extended?).

Code: Select all    protected function getSubClientNames()
        return $this->getContext()->getConfig()->get('client/html/catalog/navigation/standard/subparts', ['search']);

found a better solution

Code: Select all<?php

namespace Aimeos\Client\Html\Catalog\Search;

class Factory implements \Aimeos\Client\Html\Common\Factory\Iface
    public static function createClient( \Aimeos\MShop\Context\Item\Iface $context, array $templatePaths, $name = null )
        $context->getConfig()->set('client/html/catalog/filter/standard/subparts', ['search'] );

        return \Aimeos\Client\Html\Catalog\Filter\Factory::createClient($context, $templatePaths, $name);