Post by hoangduy1505 » Thu Apr 04, 2019 10:49 pm

Hi all,
Please help me, how to show sub-category products in parent category. In opencart 3020 I add <'filter_sub_category' => true,> into <catalog/controller/product/category.php> it work well, but when I upgrade to opencart 3031. When I add, it not work.
Please help me, I dont want downgrade to 3020

Newbie

Posts

Joined
Mon May 22, 2017 9:46 pm

Post by letxobnav » Thu Apr 04, 2019 11:40 pm

double check your change as the queries are the same in both versions.

'filter_sub_category' => true,

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by hoangduy1505 » Fri Apr 05, 2019 12:10 pm

letxobnav wrote:
Thu Apr 04, 2019 11:40 pm
double check your change as the queries are the same in both versions.

'filter_sub_category' => true,
Hi,
I replace
$filter_data = array(
'filter_category_id' => $category_id,
'filter_filter' => $filter,
'sort' => $sort,
'order' => $order,
'start' => ($page - 1) * $limit,
'limit' => $limit
);
to
$filter_data = array(
'filter_category_id' => $category_id,
'filter_sub_category' => true,
'filter_filter' => $filter,
'sort' => $sort,
'order' => $order,
'start' => ($page - 1) * $limit,
'limit' => $limit
);
I clear cache but it not work, I dont know what problem

Newbie

Posts

Joined
Mon May 22, 2017 9:46 pm

Post by letxobnav » Fri Apr 05, 2019 1:43 pm

well, the query should be ok with that, if the results are not then you have another problem.

You can check the query by adding :

Code: Select all

error_log($sql);
before

Code: Select all

$query = $this->db->query($sql);
in the function

Code: Select all

public function getProducts($data = array()) {

of file

Code: Select all

catalog/model/catalog/product.php

then you can view the created query in your error log.

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by WebiggleStore » Sat Oct 24, 2020 7:39 pm

hoangduy1505 wrote:
Fri Apr 05, 2019 12:10 pm
letxobnav wrote:
Thu Apr 04, 2019 11:40 pm
double check your change as the queries are the same in both versions.

'filter_sub_category' => true,
Hi,
I replace
$filter_data = array(
'filter_category_id' => $category_id,
'filter_filter' => $filter,
'sort' => $sort,
'order' => $order,
'start' => ($page - 1) * $limit,
'limit' => $limit
);
to
$filter_data = array(
'filter_category_id' => $category_id,
'filter_sub_category' => true,
'filter_filter' => $filter,
'sort' => $sort,
'order' => $order,
'start' => ($page - 1) * $limit,
'limit' => $limit
);
I clear cache but it not work, I dont know what problem
I find something helpful in this which is working for me.

Extension Developer & Designer | Dedicated Opencart Support | Email: info@webiggle.com | Skype: live:.cid.64dee15a2bf28467 | store.webiggle.com


User avatar
Newbie

Posts

Joined
Mon Jun 24, 2019 12:51 am
Who is online

Users browsing this forum: Bing [Bot] and 21 guests