Jump to content

Category - Sub Category display

Category - Subcategory

  • Please log in to reply
No replies to this topic

#1 Sonelal Singh

Sonelal Singh


  • Members
  • Pip
  • 8 posts

Posted 22 September 2015 - 03:17 AM

I have a question on previous forum(mentioned below)




How can I use below code when we have to use category with multiple fields(for example editing/adding user info).

I have two tables(users and category) like below - 

  • "users" table have following  fields --->user_id,name,gender,category.
  • "category" table have following fields ---> id,category,parent_id


       $crud = new grocery_CRUD();
        $crud->set_relation('category', 'categories', 'category');
       /* Add this customisation for parent_relation */
        $primary_id_field  = 'id';
        $table_name   = 'categories';
        $relation_field_name = 'parent_id';
        $parent_field   = 'parent_id';
        $title_field   = 'category';
        $title_display_as  = 'Select Categoria';
        $where    = array('stato'=>'1');//not required
        $same_table   = true; //not required, the default is false
        $output['output'] = $crud->render();

        $this->load->view('template', $output);


Here how can I populate category like post-1-0-41549700-1334271141_thumb.png  when I am using two tables.




Thanks in advance.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users