Jump to content

Upgraded our Prestashop to 1.6.0.14. Having problems with categories now.


Recommended Posts

Hi all,

 

We've recently upgraded our store from 1.4.0.15 to 1.6.0.14 and for the most part things are working fine, however something seems critically wrong with our categories.

 

We used to have a root category (in ps_category this category has id_category of "1" and id_parent "0"), but somehow for some reason after the upgrade Prestashop seems to have decided that category id "2" is the root category now.

 

Tracing through the code, it seems like the problem started from $shop->getCategory().

 

It seems like forcibly making this function return "1" fixes the problem in some of the places.

 

I'm not able to work out what's causing the $shop->id_category problem to be set to "2" in the first place, so I am wondering if anyone more experienced with how Prestashop works can offer some advice as to where it happens?

 

Thank you!

Link to comment
Share on other sites

One way this problem manifests itself can be seen in Catalogs -> Products -> Association.

 

When a "patch" is made in classes/shop/Shop.php at getCategory() to forcibly return a "1" every time, a more desirable result occurs.

 

post-565632-0-70869100-1429598601_thumb.png

 

However, without the patch, the behaviour is that the category tree is rooted in one of our subcategories.

 

post-565632-0-43509200-1429598602_thumb.png

 

I simply can't work out why this is happening, because in the database table (ps_category), that 2nd category is neither defined as a root category nor does it have a id_parent of 0. Any help or insight into this will be appreciated :(

Link to comment
Share on other sites

I seem to recall also having a fair bit of trouble figuring that one out when we had something similar happen.

 

I believe the reason for the change, is due to the multishop code which was added in 1.5, rather than just having a single root category now, I believe it expected there to be a root category and then a root shop category below it, so all you should need to do is make sure that on the database, there's a category with ID 2 that has a parent pointing to 1, with all your other categories linking to 2 rather than 1, and I suspect that should sort the problem out

 

I'd take a backup of the database before changing anything just in case

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...