Jump to content

How to subselect in select-field (dynamic)?


Recommended Posts

Hello, I'm getting stuck trying to build a filter between subcategories and some items.


For the final Item itself, I setup a reference field and wrote following selector:

If there are more entries, filtering by manufacturer (which is part of the item) would be very helpful.
The problem I'm stuck: How I can get and select an existing manufacturer field, which exist here: fieldset_device.manufactor

I tried a hook, just not happy with the result, I despair on:

$wire->addHookAfter('InputfieldPage::getSelectablePages', function($event) {
    $page = $event->arguments('page');
    if($event->object->hasField == 'hardware_manfilter') {
        $subcat = $page->hardware_subcategory;
        $items = $event->pages->find("parent=$subcat");
        $event->return = $items->each('fieldset_device.manufactor');

I appreciate any help. 

Link to comment
Share on other sites

Thank you @tires, but I'm looking for a solution, that let me directly select the manufactor depending on chosen "hardware_subcategoy". This field has a page field, that hold the info about manufactorrer. I need to divide Articles by manufator, just before select an Arricle from. 
In this case I figured out, that I can change the Label-Field from Title to a custome one:
The result shows stored manufactor to each item, not quit what I'm looking for, but I can see, it's somehow possible reaching the pagefield "manufactor" within a fieldset in my template:
Instead I need first a list of available manufactorer, unique, so then I just can select the prefiltered Articles (item) in the 4th select-field, named "hardware_item". The last custom Selector String for this 4th select(pagefield) should be "parent=page.hardware_manfilter".

Selector String: Something like this does not work:

In a hook Ive tried only the  These selector, without the subselcet, but here I have to save the page to see some Changes which otherwise are dynamic.

$event->return = $page->hardware_subcategory->children;

I hope my Quest is more clear and I ask again:
      Whats the best way doing it, is it possible?
Thanks in Advance.


Link to comment
Share on other sites

  • August changed the title to How to subselect in select-field (dynamic)?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...