I want to add the category tree into select multiple options control
I search lot on this got this link
but it gives me output in ul li structure as follows

but I want this tree structure into select multiple options
can any one knows what to do changes in the link code
Preparing array:
public function getCategoriesArray() {
$categoriesArray = Mage::getModel('catalog/category')
->getCollection()
->addAttributeToSelect('name')
->addAttributeToSort('path', 'asc')
->load()
->toArray();
$categories = array();
foreach ($categoriesArray as $categoryId => $category) {
if (isset($category['name']) && isset($category['level'])) {
$categories[] = array(
'label' => $category['name'],
'level' =>$category['level'],
'value' => $categoryId
);
}
}
return $categories;
}
Displaying in form:
$fieldset->addField('categories', 'multiselect', array(
'label' => $this->__('Categories'),
'name' => 'categories',
'values' => Mage::getModel(...)->getCategoriesArray(),
));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With