2

Is there any way to add a category tree with checkboxes to a form in the admin part?

The form contains two other fieldsets, and the category tree must be added as the third fieldset. All information that I have found was how to add a category tree separately, without injecting it in existing form. But here I need to render a block inside another block, or something like this.

I am curious how can I achieve this.

1

you will find here and example about how to add the category tree in a separate tab.
You can start from there.
The block that renders the category tree behaves like any other block so it can be included anywhere.
All you have to do is to change the layout file and include that block in an other block and then display it using getChildHtml.
Or you can create a form element that uses a custom renderer and this renderer should be the block in question, but this is a little complicated.

| improve this answer | |
  • Thanks! But addTab method is used there. I don't use it, I add tabs through xml declaration. Should I skip that step? – Gino Pane Nov 4 '15 at 8:44
  • yes, you can skip that step – Marius Nov 4 '15 at 8:45
  • it seems, that quantities of subcategories are not displayed (in round brackets). – Gino Pane Nov 4 '15 at 13:11
  • Maybe, you know how to enable display of those quantities, like this: prntscr.com/8yx9no? – Gino Pane Nov 4 '15 at 13:29
  • it's kind of complicated. you need to add to the collection the product count and you need to change the method that displays the node. I don't remember how it's called. – Marius Nov 4 '15 at 13:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.