OpenCart categories are not showing up

Viewed 18439

The categories have:

  1. The "top" option marked already
  2. They're assigned to a store
  3. They're assigned to a manufacturer

And they're still not being shown. I don't think this is a code issue as it was working just fine with the default products/categories and I haven't touched the code yet.

I've researched a lot, but people always say that marking the "Top" option should solve the issue.

Please take a look into the below screenshots.

http://postimg.org/image/yv6p186kf/
http://postimg.org/image/wcl00jku7/
postimg.org/image/pbx07rj27

Thanks

Edit:

I'm using OpenCart v1.5.6

Edit 2:

It is a parent category. For those who are still researching this, please read my answer.

5 Answers

The component is written to return just 5 top results, the issue arises after there is a categories overload

to Fix the issue goto file

/admin/controller/catalog/category.php

function autocomplete()
{
$json = array();
if (isset($this->request->get['filter_name']))
    {
    $this->load->model('catalog/category');
    $filter_data = array(
        'filter_name' => $this->request->get['filter_name'],
        'sort' => 'name',
        'order' => 'ASC',
        'start' => 0,
        'limit' => 5
    );
    $results = $this->model_catalog_category->getCategories($filter_data);
    foreach($results as $result)
        {
        $json[] = array(
            'category_id' => $result['category_id'],
            'name' => strip_tags(html_entity_decode($result['name'], ENT_QUOTES, 'UTF-8'))
        );
        }
    }

$sort_order = array();
foreach($json as $key => $value)
    {
    $sort_order[$key] = $value['name'];
    }

array_multisort($sort_order, SORT_ASC, $json);
$this->response->addHeader('Content-Type: application/json');
$this->response->setOutput(json_encode($json));
}

and change limit from 5 to a higher number, preferably 20 in

 $filter_data = array(
        'filter_name' => $this->request->get['filter_name'],
        'sort' => 'name',
        'order' => 'ASC',
        'start' => 0,
        'limit' => 20
    );

Here is the issue I ran into. When you are in the admin area and trying to select the category that your product belongs to... Make sure you fully click. I dont have a mouse, so if you have a mouse or trackball this may not address your issue. My Asus Laptop finger pad allows me to lightly tap or fully click the pad to navigate. I had to make sure I clicked my category choices. If I only tapped the pad lightly it pretended to make a selection and the category would not register. So my issue was probably related to a javascript/hardware quirk. Wasted an hour with that one.... LOL.

Hope this helps someone else. I am using Opencart version 3.0.3.8

The powers that be at stack exchange may not have the same hardware as me or some of us. Please dont flag this post because you don't understand this post. This will help someone else. These people think they know everything. And probably filter out some good answers.

Related