protected function setDataCategoriesEditCategory()
    {
        $category_id = $this->getData('category.category_id');

        if (isset($category_id)) {

            $category_group_id = $this->getData('category_group.category_group_id');

            $options = array(
                'parent_id' => $category_id,
                'category_group_id' => $category_group_id
            );

            $children = $this->category->getTree($options);

            $exclude = array($category_id);
            foreach ($children as $child) {
                $exclude[] = $child['category_id'];
            }

            $categories = $this->getData('categories');
            $modified = array_diff_key($categories, array_flip($exclude));
            $this->setData('categories', $modified);
        }
    }
protected function setDataCategoriesEditCategory()
    {
        $category_id = $this->getData('category.category_id');

        if (isset($category_id)) {

            $category_group_id = $this->getData('category_group.category_group_id');

            $options = array(
                'parent_id' => $category_id,
                'category_group_id' => $category_group_id
            );

            $children = $this->category->getTree($options);

            $exclude = array($category_id);
            foreach ($children as $child) {
                $exclude[] = $child['category_id'];
            }

            $categories = $this->getData('categories');
            $modified = array_diff_key($categories, array_flip($exclude));
            $this->setData('categories', $modified);
        }
    }
protected function setDataCategoriesEditCategory ( ) { $ category_id = $ this -> getData ( 'category.category_id' ) ; if ( isset ( $ category_id ) ) { $ category_group_id = $ this -> getData ( 'category_group.category_group_id' ) ; $ options = array ( 'parent_id' => $ category_id , 'category_group_id' => $ category_group_id ) ; $ children = $ this -> category -> getTree ( $ options ) ; $ exclude = array ( $ category_id ) ; foreach ( $ children as $ child ) { $ exclude [ ] = $ child [ 'category_id' ] ; } $ categories = $ this -> getData ( 'categories' ) ; $ modified = array_diff_key ( $ categories , array_flip ( $ exclude ) ) ; $ this -> setData ( 'categories' , $ modified ) ; } }
Adds list of categories on the edit category page
Adds list of categories on the edit category page