cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 2 tree category. Admin. System

Magento 2 tree category. Admin. System

Hi

How to display a category tree in system.xml and from weseckbox and after "save" have a table of selected categories?

4 REPLIES 4

Re: Magento 2 tree category. Admin. System

Actually, I mean the category tree where I select and deselect categories in the checkbox.

Re: Magento 2 tree category. Admin. System


@liteblue wrote:

Hi

How to display a category tree in system.xml and from weseckbox and after "save" have a table of selected categories?


What is the problem? Just add condition : IF currentCategory dosn't have childs THEN use parent id of currentCategory as currentCategoryId

 

Re: Magento 2 tree category. Admin. System

This is not the problem. I do not know how to have in system.xml just like here, but that they should be categoriestreetree

 

 

I am a beginner in Magento programming and I don't know how to deal with it Smiley Sad

Re: Magento 2 tree category. Admin. System

I managed to do just like in the picture. But unfortunately it saves only one value for me Smiley Sad

2021-11-30 at 21-59-20.png

 <field id="ep_category" translate="label" type="checkboxes" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
                    <label>Wybierz katetegorie</label>
                    <source_model>Test\Ep\Model\Config\Source\Category</source_model>
                    <backend_model>Magento\Config\Model\Config\Backend\Serialized\ArraySerialized</backend_model>
                </field>