Skip to content
This repository has been archived by the owner on Dec 2, 2022. It is now read-only.

Commit

Permalink
Fix #50 Remove exact same method `Category_model::get_category_childr…
Browse files Browse the repository at this point in the history
…en()`
  • Loading branch information
panigrc authored Aug 25, 2020
2 parents 3d2bbcb + d718e37 commit df266a9
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 23 deletions.
2 changes: 1 addition & 1 deletion application/blocks/categoryBlock.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public static function view($CI, array $vars)
[
'categories_arr' => $CI->category_model->get_all_category_ids_recursive(),
'parent' => $CI->category_model->get_category_parents($vars['category_id']),
'children' => $CI->category_model->get_category_children($vars['category_id']),
'children' => $CI->category_model->get_all_category_ids_recursive($vars['category_id']),
'current' => $vars['category_id']
],
TRUE
Expand Down
22 changes: 0 additions & 22 deletions application/models/Category_model.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,28 +24,6 @@ public function get_all_category_ids_recursive(int $parent_id = 0): array
return $ids;
}

/**
* Get all children categories of $id
*
* @param int $id Category Id
* @return array
*/
public function get_category_children(int $id): array
{
$this->db->select('*');
$this->db->from('categories');
$this->db->where('parent_category_id', $id);
$query = $this->db->get();
$ids = [];
foreach ($query->result_array() as $row)
{
$temp = $this->get_category_children($row['category_id']);
$ids[$row['category_id']] = $temp;
}

return $ids;
}

/**
* Gets all parent categories of $id
*
Expand Down

0 comments on commit df266a9

Please sign in to comment.