Back to JKShop Support

Sergey
Sergey

Clean october 428. clean jkshop. Incorrect display сategory inside product creation. See picture in category all fine: https://imgur.com/a/hHCoH in product creation no: https://imgur.com/a/0Q8gP

Last updated

Sergey
Sergey

UPD. same problem in edit\create category : https://imgur.com/a/VLZQp

Jiri Kubak
Jiri Kubak

Sergey said:

UPD. same problem in edit\create category : https://imgur.com/a/VLZQp

Hi,

i expect this should show your category tree - so maybe check if your tree is correct. If not maybe try to create an issue on OctoberCMS support because this is nested tree and relation standard implementation.

Jiri

Mr Hound
Mr Hound

Jiri Kubak said:

i expect this should show your category tree - so maybe check if your tree is correct. If not maybe try to create an issue on OctoberCMS support because this is nested tree and relation standard implementation.

Jiri,

I have exactly the same problem.
Categories are displayed in order of creation, not in the order in which they are organized.

From a scratch website (October Cms v434 and JkShop v1.7.3), I've create my categories level by level.
Here is my categories (id/name)

 #1  Toys
 #3     Board games
 #4     Creative activities
 #5     Building sets
 #2  Clothes
 #6      Babys
 #9          Girl
 #10         Boy
 #7      Girls
 #11         2 - 6 years
 #12         7 - 14 years
 #8      Boys
 #13         2 - 6 years
 #14         7 - 14 years

And how categories display in backend controllers :


Toys
Clothes
    Board games
    Creative activities
    Building sets
    Babys
    Girls
    Boys
        Girl
        Boy
        2 - 6 years
        7 - 14 years
        2 - 6 years
        7 - 14 years

in their creation order (or id) !!
The reordering doesn't work anymore for backend list controlers !!

I didn't have any problems to manage nested trees in blog plugin (or others like daftspunk/test-plugin ) installed for a test.
Can't check on demo site, categories are not manageables.

Last updated

Mr Hound
Mr Hound

Jiri Kubak said:

i expect this should show your category tree - so maybe check if your tree is correct. If not maybe try to create an issue on OctoberCMS support because this is nested tree and relation standard implementation.

I answer myself after spending times to investigate.

  • JkShop version : 1.7.5
  • file : plugins/jiri/jkshop/models/Product.php
  • function : public $belongsToMany
  • line : 157
  • code :
    Before:
        'categories' => [
            'Jiri\JKShop\Models\Category',
            'table'    => 'jiri_jkshop_products_categories',
            'key'      => 'product_id',
            'otherKey' => 'category_id',
        ], 

    After:

        'categories' => [
            'Jiri\JKShop\Models\Category',
            'table'    => 'jiri_jkshop_products_categories',
            'order'    => 'nest_left',
        ], 

    With the remove of unnecessary definitions.

This way, the categories show in their respective order in the back-end select box.

Last updated

Jiri Kubak
Jiri Kubak

Thank you @Mr Hound i will fix this in a next version ;)

Jiri

1-6 of 6