php - Opencart: admin category list display by user_id


i have 3 users my opencart admin, as follows:

  • user_id=1
  • user_id=2
  • user_id=3

what my question is, ifuser_id=1 User add some categories to admin category list (eg: computer, cellphone, tab, etc.) whenuser_id=2 or other users login time no need to display... i mean what each users added to categories lists, that only show when they logged their user account... dont allow to show other users...


public function getCategories($parent_id = 0) {
    $category_data = $this->cache->get('category.' . (int)$this->config->get('config_language_id') . '.' . (int)$parent_id);

    if (!$category_data) {
        $category_data = array();

        $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "category c LEFT JOIN " . DB_PREFIX . "category_description cd ON (c.category_id = cd.category_id) WHERE c.parent_id = '" . (int)$parent_id . "' AND cd.language_id = '" . (int)$this->config->get('config_language_id') . "' ORDER BY c.sort_order, ASC");

        foreach ($query->rows as $result) {
            $category_data[] = array(
                'category_id' => $result['category_id'],
                'name'        => $this->getPath($result['category_id'], $this->config->get('config_language_id')),
                'status'      => $result['status'],
                'sort_order'  => $result['sort_order']

            $category_data = array_merge($category_data, $this->getCategories($result['category_id']));

        $this->cache->set('category.' . (int)$this->config->get('config_language_id') . '.' . (int)$parent_id, $category_data);

    return $category_data;

any idea.?? thanks...

People are also looking for solutions to the problem: php - JS events. Only one of the event handler function is being called?


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.