eriknuds Posted March 29, 2015 Share Posted March 29, 2015 Hi, I have the 1.6.0.14 version, and when I'm using the webservice call to update a category, the nleft and nright columns are left blank (even if they had no reason to change). Usually when you add/update a category using the GUI, the Category class will regenerate the NTree and repopulate the nleft/nright values. If this is not done, the category tree may disappear from the store pages.The NTree regeneration is not done when updating a category using the webservice, and inspecting the Category class I see that doNotRegenerateNTree must have been set to true for this to happen. Yet I can find no place in the source code it is set to true, and I can see no way to set it to false so that after my update, the Category::regenerateEntireNtree() method is called. As PHP is not one of my native programming languages, I may have overlooked something though.From the category class update() method: if (!isset($this->doNotRegenerateNTree) || !$this->doNotRegenerateNTree) { Category::regenerateEntireNtree(); $this->recalculateLevelDepth($this->id); } Any ideas how the doNotRegenerateNTree is set to false, using the webservice, and how to prevent that, or how to force Category::regenerateEntireNtree(); to run in any way at all, using the webservice interface? I wouldn't mind having a way to turn regeneration off while I do a lot of category updates, then forcing it to happen at the end. I see that the $webserviceParameters in the Category class adds the nleft and nright columns as hidden_fields but I'm not sure what to make of that and if this can be used to my advantage somehow. I'd rather not override the class just to mend the webservice functionality, I hope there is a more generic solution - if it's a bug, it should just be fixed, though maybe it can be worked around for the time being as well. Regards, Erik Knudsen Link to comment Share on other sites More sharing options...
a.koenig Posted May 31, 2015 Share Posted May 31, 2015 (edited) I have the same problem with Prestashop 1.6.0.14. After changinging a category by the webservice, both the nleft and nrigth fields of the category are set to 0. It seems to be a bug in the webservice and should be fixed there! This bug is a blocker, because the related categories are displayed in the category tree furthermore, but clicking to them results in a 404 page! prerequisites: SELECT nleft,nright FROM `ps_category` WHERE `id_category`=12--> nleft: 20; nright: 23 action: PUT: http://localhost:8080/prestashop/api/categories/12 <?xml version="1.0" encoding="UTF-8" standalone="yes"?><prestashop> <category> <id>12</id> <id_parent>3</id_parent> <active>1</active> <is_root_category>0</is_root_category> <name><language id="1">category name</language></name> <link_rewrite><language id="1">category_name</language></link_rewrite> <description><language id="1">category description</language></description> <date_add>2015-05-31 11:42:55</date_add> </category></prestashop> current behavior after action: --> nleft: 0; nright: 0 expected behavior after action: --> nleft: 20; nright: 23 Edited May 31, 2015 by a.koenig (see edit history) Link to comment Share on other sites More sharing options...
colombinif Posted June 25, 2015 Share Posted June 25, 2015 Hi, I have same problem. I have same version 1.6.0.14 I also try to simulate a different <position> to force tree rebuilding, but sometime ignore also it. Is there a solution or bug correction ? Best regards, Fabrizio Colombini Link to comment Share on other sites More sharing options...
a.koenig Posted September 18, 2016 Share Posted September 18, 2016 tested again with release 1.6.1.7 and now it works fine 1 Link to comment Share on other sites More sharing options...
eriknuds Posted September 18, 2016 Author Share Posted September 18, 2016 Nice! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now