Jump to content

[Solved] categories abc order wrong


Recommended Posts

And unfortunately - evry newly opened category just see in the subcategory of the prviously addad category - as I see it on the product page!

but the home category page is just shown on the last position?

is it a bug?

Link to comment
Share on other sites

I was check the ps_category table in my database and evrything look fine

the parent category is 1 what means it could show under the root, the position is 75 what means this is a 75th row in the category!

so it could be the problem with the displaying not with the program!

please someone help me find this out

Link to comment
Share on other sites

I was check the ps_category table in my database and evrything look fine

the parent category is 1 what means it could show under the root, the position is 75 what means this is a 75th row in the category!

so it could be the problem with the displaying not with the program!

please someone help me find this out


How can anyone help if you're not even posting a link to your site?

Did you try to resort the categories in the backoffice?

PS < 1.4 was using numbers for order, in PS 1.4+ there is a new sort order field in the database, which is used to display them in order.
Link to comment
Share on other sites

Hi tomerg

Of course I set the order of the category (what I created last time) to the exact position!

The category looks fine in the BO

but if I start to add a new product --> this last created category what could be on root ---> just appear in the last root category as a subcategory!

And I don't know why!

for example:


A
B
C
D are my root categories --> if I wanna create E on the root --> the result will be

A
B
C
D-E

Link to comment
Share on other sites

I had the same problem and I discovered that the problem was with the column "level_depth" value for the category table. Because in the display php code the database request order by level_depth and position field.

This value should be set according of the level on the category three. 1 for first level, 2 for second level, and so on...


http://www.prestashop.com/forums/viewthread/98989/ (In french ) .

Hope it will help you

Link to comment
Share on other sites

Yes! I find it out when I checked the ps_category table, but it is not dispalying on the root, even if the level depth is right!

That is why I do not understand what happening


I think that the best thing to do in your case is to extract the SQL statement from the Category.php source code and play it in the phpmyadmin sql screen.
Then you should see how (there is an "order by" ) is extract information from database and anderstand wich value is not correct.

For information in my source code the statement is in the file
prestashop\modules\blockcategories\blockcategories.php line 151

So here is (mine) the sql statement used. As you can see the request depends of lang settings and group value

The variables used in this statement are :
LANG-VARIABLE = your shop langage id
CATEGORY-VARIABLE = your category id
LEVEL-TO-DISPLAY = number of Level to display
GROUP-TO-DISPLAY = Group ID to display (it depends of the nature of clients)

SELECT c.id_parent, c.id_category, cl.name, cl.description, cl.link_rewrite
FROM ps_category c
LEFT JOIN ps_category_lang cl ON (c.id_category = cl.id_category AND id_lang = LANG-VARIABLE)
LEFT JOIN ps_category_group cg ON (cg.id_category = c.id_category)
WHERE (c.active = 1 OR c.id_category = CATEGORY-VARIABLE)
AND level_depth <= LEVEL-TO-DISPLAY
AND cg.id_group = GROUP-TO-DISPLAY
ORDER BY level_depth ASC, c.position ASC
Link to comment
Share on other sites

Please watch the picture, what I am talking about:

my last added category is the "puzzle" what I created under the root

(when I created it, doesn't matter what is the first letter, it creates as the last one on the category tab)

1st question (is it normal to put the category to the last position?

after it I manually pull it up to the 75. position (because we need abc ordering to show categories)


see it on the first pic marked with red

see the phpmyadmin pics about the database position on pics 2

BUT when I want to add a new product, there is something wrong, because this category is just under something else in the end of the root categories.. please see pic 3


IS IT A BUG!

45124_0vmtzOt6HmV6OdCZRjM8_t

45125_ZNdA17QMpnApXqCdwCkA_t

45126_69YeYEqH90W5zy66c5Mc_t

Link to comment
Share on other sites

Please watch the picture, what I am talking about:

my last added category is the "puzzle" what I created under the root

(when I created it, doesn't matter what is the first letter, it creates as the last one on the category tab)

1st question (is it normal to put the category to the last position?

after it I manually pull it up to the 75. position (because we need abc ordering to show categories)


see it on the first pic marked with red

see the phpmyadmin pics about the database position on pics 2

BUT when I want to add a new product, there is something wrong, because this category is just under something else in the end of the root categories.. please see pic 3


IS IT A BUG!


Yes, there is a bug. What you describe is what i lived too.
And to solve the problem, you must adjust thé depth-level column value.
I'll try to post more detail solution this evening
Link to comment
Share on other sites

Please watch the picture, what I am talking about:

my last added category is the "puzzle" what I created under the root

(when I created it, doesn't matter what is the first letter, it creates as the last one on the category tab)

1st question (is it normal to put the category to the last position?

after it I manually pull it up to the 75. position (because we need abc ordering to show categories)


see it on the first pic marked with red

see the phpmyadmin pics about the database position on pics 2

BUT when I want to add a new product, there is something wrong, because this category is just under something else in the end of the root categories.. please see pic 3


IS IT A BUG!


So I re check on my database and do some test. And For me you have the same that me and de solution is : Update the column level_depth to 1 where the id_category = 238.
refresh screen and you should see the item at the true place.

Remember that the position value is the position in the level.
Link to comment
Share on other sites

I found the final point of this problem on the prestashop bug report

here http://forge.prestashop.com/browse/PSCFI-1596

The main problem is the

found the reason.... the first category (home) must have level_depth at ZERO!
don't know why it was set up to 'ONE' maybe from previous updates.
because the script when you update category change the level depth value to the parent one + 1.


So I updated the row of my firs category and now each new category is coorctly created in the tree.
Link to comment
Share on other sites

Hi dmsft!

thanks for your reply...yes it solve my problem temporary, but dou you know any solution,
why any newly created category get 1 level deeper where I create it???

anybody know about this bug?

devilsown: NO I dod not use oscommerce importer, that plugin is totally deleted..

Link to comment
Share on other sites

Hi dmsft!

thanks for your reply...yes it solve my problem temporary, but dou you know any solution,
why any newly created category get 1 level deeper where I create it???

....


This is because your First Category level depth is si to 1 rather 0. Look at it in your database.
This solution worked for me. And now my new categories are correctly created.


What I anderstand of this bug is that the problem is in the migration procedure. It's set the first category level_depth value to 1 rather than 0.... And this was the beginning of our problems....

Maybe you could find more detailed information in the prestashop bug report.
Link to comment
Share on other sites

×
×
  • Create New...