[Skip to main content](#vessel-content)

#   How to change the order categories are shown at Otree

##

- **[PeterChain](/forum/user/570-peterchain "View PeterChain's Profile")**
- [![PeterChain's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar570.png)](/forum/user/570-peterchain "View PeterChain's Profile") Topic Author
- [ Offline](/forum/user/570-peterchain)

Less More

- Posts: 640
- Thank you received: 16
-
-

9 years 9 months ago -  9 years 9 months ago [\#262679](#262679) by [PeterChain](/forum/user/570-peterchain "View PeterChain's Profile")  *[How to change the order categories are shown at Otree](/forum/23-market-how-to/888914-how-to-change-the-order-categories-are-shown-at-otree#262679 "-- HikaShop version -- : 3.0 -- HikaMarket version -- : 1.7.3 -- Joomla version -- : 3.6.5  In my product lists OTree is showing always categories sorted by alphabetical order and ignoring the order in which are sorted at the backend categories list.  How can I change the -&gt;displayTree parameters to make it show the categories sorted by the category order ?")* was created by *[PeterChain](/forum/user/570-peterchain "View PeterChain's Profile")*

-- HikaShop version -- : 3.0
-- HikaMarket version -- : 1.7.3
-- Joomla version -- : 3.6.5

In my product lists OTree is showing always categories sorted by alphabetical order and ignoring the order in which are sorted at the backend categories list.

How can I change the -&gt;displayTree parameters to make it show the categories sorted by the category order ?

Last edit: 9 years 9 months ago by [PeterChain](/forum/user/570-peterchain "View PeterChain's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzIzLW1hcmtldC1ob3ctdG8vODg4OTE0LWhvdy10by1jaGFuZ2UtdGhlLW9yZGVyLWNhdGVnb3JpZXMtYXJlLXNob3duLWF0LW90cmVlP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Jerome](/forum/user/80-jerome "View Jerome's Profile")**
- [![Jerome's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar80.png)](/forum/user/80-jerome "View Jerome's Profile")
- [ Offline](/forum/user/80-jerome)
- HikaShop core developer

Less More

- Posts: 26401
- Thank you received: 4081
-
- [](http://obsi.dev)
-

9 years 9 months ago [\#262697](#262697) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[How to change the order categories are shown at Otree](/forum/23-market-how-to/888914-how-to-change-the-order-categories-are-shown-at-otree#262697 "-- HikaShop version -- : 3.0 -- HikaMarket version -- : 1.7.3 -- Joomla version -- : 3.6.5  In my product lists OTree is showing always categories sorted by alphabetical order and ignoring the order in which are sorted at the backend categories list.  How can I change the -&gt;displayTree parameters to make it show the categories sorted by the category order ?")*

Hi,

I'm sorry but you did not provide the full context.
Where is that category tree that you're talking about ?

Regards,

---

Jerome - Obsidev.com
HikaMarket &amp; HikaSerial developer / HikaShop core dev team.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzIzLW1hcmtldC1ob3ctdG8vODg4OTE0LWhvdy10by1jaGFuZ2UtdGhlLW9yZGVyLWNhdGVnb3JpZXMtYXJlLXNob3duLWF0LW90cmVlP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[PeterChain](/forum/user/570-peterchain "View PeterChain's Profile")**
- [![PeterChain's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar570.png)](/forum/user/570-peterchain "View PeterChain's Profile") Topic Author
- [ Offline](/forum/user/570-peterchain)

Less More

- Posts: 640
- Thank you received: 16
-
-

9 years 9 months ago [\#262747](#262747) by [PeterChain](/forum/user/570-peterchain "View PeterChain's Profile")  Replied by *[PeterChain](/forum/user/570-peterchain "View PeterChain's Profile")* on topic *[How to change the order categories are shown at Otree](/forum/23-market-how-to/888914-how-to-change-the-order-categories-are-shown-at-otree#262747 "-- HikaShop version -- : 3.0 -- HikaMarket version -- : 1.7.3 -- Joomla version -- : 3.6.5  In my product lists OTree is showing always categories sorted by alphabetical order and ignoring the order in which are sorted at the backend categories list.  How can I change the -&gt;displayTree parameters to make it show the categories sorted by the category order ?")*

The CategoryTree is the one in the left side column of a Frontend Product List.

I made it to avoid showing ROOT, I can preestablish the number of tree levels that show opened at load time, but can't handle to use the natural sorting of the Categories in hikashop category list, I always get it sorted by the Category ID (and not alphabetically as I stated initially in this post).

In contrast, with the HikaShop views in the backend they show accordingly to the way the categories are sorted in the category list.

––––

Additionally I would like to be able to choose (no matter if it is by code) if the UNPUBLISHED categories should be listed in Frontend product lists.

Now they do always.

If they had been unpublished in the backed or in the frontend Category List - Category Edition would make sense that frontend users don't have access to them at the Product List time,

I understand users must see them in the Category List in order to edit and eventually REPUBLISH them, but would be fair that a user having access to Product Lists does not have to deal with unpublished categories.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzIzLW1hcmtldC1ob3ctdG8vODg4OTE0LWhvdy10by1jaGFuZ2UtdGhlLW9yZGVyLWNhdGVnb3JpZXMtYXJlLXNob3duLWF0LW90cmVlP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Jerome](/forum/user/80-jerome "View Jerome's Profile")**
- [![Jerome's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar80.png)](/forum/user/80-jerome "View Jerome's Profile")
- [ Offline](/forum/user/80-jerome)
- HikaShop core developer

Less More

- Posts: 26401
- Thank you received: 4081
-
- [](http://obsi.dev)
-

9 years 9 months ago [\#262780](#262780) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[How to change the order categories are shown at Otree](/forum/23-market-how-to/888914-how-to-change-the-order-categories-are-shown-at-otree#262780 "-- HikaShop version -- : 3.0 -- HikaMarket version -- : 1.7.3 -- Joomla version -- : 3.6.5  In my product lists OTree is showing always categories sorted by alphabetical order and ignoring the order in which are sorted at the backend categories list.  How can I change the -&gt;displayTree parameters to make it show the categories sorted by the category order ?")*

Hi,

1 - I'm sorry but the category tree in the HikaMarket frontend product listing is sorted regarding the category ordering.
As you can see in the demo website : [ pasteboard.co/zS6QJ0wbC.png](http://pasteboard.co/zS6QJ0wbC.png)
The list of the categories are coming from the function "getList" of the HikaMarket category class where you can see the ordering: Code:

$this-&gt;db-&gt;setQuery($select . $table . $where . ' ORDER BY a.category_left ASC');

So I'm afraid that I don't know how you changed that other ordering ; but that's not something made by default

2. In that same function, you will see the filters for the categories and you'll see that unpublished categories are loaded as well.
When you give an access to a category, the vendor will have access to that category and every sub categories.

3. A product can be in several categories in the same time ; unpublished categories can be used for module listing, discounts, fields restrictions and so much more.

So that's a by design rule and it's hard coded in the core.

Regards,

---

Jerome - Obsidev.com
HikaMarket &amp; HikaSerial developer / HikaShop core dev team.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzIzLW1hcmtldC1ob3ctdG8vODg4OTE0LWhvdy10by1jaGFuZ2UtdGhlLW9yZGVyLWNhdGVnb3JpZXMtYXJlLXNob3duLWF0LW90cmVlP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[PeterChain](/forum/user/570-peterchain "View PeterChain's Profile")**
- [![PeterChain's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar570.png)](/forum/user/570-peterchain "View PeterChain's Profile") Topic Author
- [ Offline](/forum/user/570-peterchain)

Less More

- Posts: 640
- Thank you received: 16
-
-

9 years 9 months ago [\#263286](#263286) by [PeterChain](/forum/user/570-peterchain "View PeterChain's Profile")  Replied by *[PeterChain](/forum/user/570-peterchain "View PeterChain's Profile")* on topic *[How to change the order categories are shown at Otree](/forum/23-market-how-to/888914-how-to-change-the-order-categories-are-shown-at-otree#263286 "-- HikaShop version -- : 3.0 -- HikaMarket version -- : 1.7.3 -- Joomla version -- : 3.6.5  In my product lists OTree is showing always categories sorted by alphabetical order and ignoring the order in which are sorted at the backend categories list.  How can I change the -&gt;displayTree parameters to make it show the categories sorted by the category order ?")*

Hi Jerome, thank you for your feedback and sorry for answering so late.

Sadly I have to disagree with your first statement (which I would love not to as I really need it the way you say it works)

I made an absolutely clean non overrided site and the category ordering conflit persists.

It works as you say in Backend but not in HikaMarket Product Listing Frontend.

[ ![CategoryTreeOrder.jpg](/forum/attachment/36578) ](/forum/attachment/36578 "...yTreeOrder.jpg")

- [ ![CategoryTreeOrder.jpg](/forum/attachment/36578) ](/forum/attachment/36578 "...yTreeOrder.jpg") [ ](/forum/attachment/36578?download=1 "...yTreeOrder.jpg")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzIzLW1hcmtldC1ob3ctdG8vODg4OTE0LWhvdy10by1jaGFuZ2UtdGhlLW9yZGVyLWNhdGVnb3JpZXMtYXJlLXNob3duLWF0LW90cmVlP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Jerome](/forum/user/80-jerome "View Jerome's Profile")**
- [![Jerome's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar80.png)](/forum/user/80-jerome "View Jerome's Profile")
- [ Offline](/forum/user/80-jerome)
- HikaShop core developer

Less More

- Posts: 26401
- Thank you received: 4081
-
- [](http://obsi.dev)
-

9 years 9 months ago [\#263299](#263299) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[How to change the order categories are shown at Otree](/forum/23-market-how-to/888914-how-to-change-the-order-categories-are-shown-at-otree#263299 "-- HikaShop version -- : 3.0 -- HikaMarket version -- : 1.7.3 -- Joomla version -- : 3.6.5  In my product lists OTree is showing always categories sorted by alphabetical order and ignoring the order in which are sorted at the backend categories list.  How can I change the -&gt;displayTree parameters to make it show the categories sorted by the category order ?")*

Hi,

Okay.
So the rebuild tree is not taking the ordering for the ordering of the left/right values.
Change the previously mentioned line with Code:

$this-&gt;db-&gt;setQuery($select . $table . $where . ' ORDER BY a.category_parent_id ASC, a.category_ordering ASC');

And it will sort the categories depending the parent and the ordering.

Regards,

---

Jerome - Obsidev.com
HikaMarket &amp; HikaSerial developer / HikaShop core dev team.

The following user(s) said Thank You: [PeterChain](/forum/user/570-peterchain "View PeterChain's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzIzLW1hcmtldC1ob3ctdG8vODg4OTE0LWhvdy10by1jaGFuZ2UtdGhlLW9yZGVyLWNhdGVnb3JpZXMtYXJlLXNob3duLWF0LW90cmVlP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[PeterChain](/forum/user/570-peterchain "View PeterChain's Profile")**
- [![PeterChain's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar570.png)](/forum/user/570-peterchain "View PeterChain's Profile") Topic Author
- [ Offline](/forum/user/570-peterchain)

Less More

- Posts: 640
- Thank you received: 16
-
-

9 years 9 months ago [\#263340](#263340) by [PeterChain](/forum/user/570-peterchain "View PeterChain's Profile")  Replied by *[PeterChain](/forum/user/570-peterchain "View PeterChain's Profile")* on topic *[How to change the order categories are shown at Otree](/forum/23-market-how-to/888914-how-to-change-the-order-categories-are-shown-at-otree#263340 "-- HikaShop version -- : 3.0 -- HikaMarket version -- : 1.7.3 -- Joomla version -- : 3.6.5  In my product lists OTree is showing always categories sorted by alphabetical order and ignoring the order in which are sorted at the backend categories list.  How can I change the -&gt;displayTree parameters to make it show the categories sorted by the category order ?")*

Thank you Jerome!

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzIzLW1hcmtldC1ob3ctdG8vODg4OTE0LWhvdy10by1jaGFuZ2UtdGhlLW9yZGVyLWNhdGVnb3JpZXMtYXJlLXNob3duLWF0LW90cmVlP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

Moderators: [Obsidev](/forum/user/7040-obsidev "View Obsidev's Profile")

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.072 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
