H
H
hdtor2016-02-09 11:48:51
CMS
hdtor, 2016-02-09 11:48:51

Why are categories sorted incorrectly in OpenCart?

Hello.
For some reason, categories in the product catalog are not sorted correctly, not as sorting is set in the admin panel. Why?
Bezymiannyi.png
I tried to figure it out, here it seems to be a request that pulls them out of the database. Request from file catalog/model/catalog/category.php

public function getCategories($parent_id = 0) {
        $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "category c LEFT JOIN " . DB_PREFIX . "category_description cd ON (c.category_id = cd.category_id) LEFT JOIN " . DB_PREFIX . "category_to_store c2s ON (c.category_id = c2s.category_id) WHERE c.parent_id = '" . (int)$parent_id . "' AND cd.language_id = '" . (int)$this->config->get('config_language_id') . "' AND c2s.store_id = '" . (int)$this->config->get('config_store_id') . "'  AND c.status = '1' ORDER BY c.sort_order, LCASE(cd.name)");

        return $query->rows;
    }

What is the problem? Why categories are not sorted as they are displayed in the admin panel?
Thanks in advance.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question