How to change the order categories are shown at Otree

  • Posts: 634
  • Thank you received: 16
  • Hikashop Business
7 years 2 months ago #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 ->displayTree parameters to make it show the categories sorted by the category order ?

Last edit: 7 years 2 months ago by PeterChain.

Please Log in or Create an account to join the conversation.

  • Posts: 26000
  • Thank you received: 4004
  • MODERATOR
7 years 2 months ago #262697

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 & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 634
  • Thank you received: 16
  • Hikashop Business
7 years 2 months ago #262747

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 or Create an account to join the conversation.

  • Posts: 26000
  • Thank you received: 4004
  • MODERATOR
7 years 2 months ago #262780

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
The list of the categories are coming from the function "getList" of the HikaMarket category class where you can see the ordering:

$this->db->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 & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 634
  • Thank you received: 16
  • Hikashop Business
7 years 1 month ago #263286

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.

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 26000
  • Thank you received: 4004
  • MODERATOR
7 years 1 month ago #263299

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

$this->db->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 & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
The following user(s) said Thank You: PeterChain

Please Log in or Create an account to join the conversation.

  • Posts: 634
  • Thank you received: 16
  • Hikashop Business
7 years 1 month ago #263340

Thank you Jerome!

Please Log in or Create an account to join the conversation.

Moderators: Obsidev
Time to create page: 0.057 seconds
Powered by Kunena Forum