media-x Posted March 30, 2015 Share Posted March 30, 2015 Hi, 1. i have to import a complex data structure, so i write a custom import script, my question is, for fields `nleft`, `nright` i give as value 0, is there any function is shop or frontend functionality to run it and get here right values? 2. My categorys have also a image, who can i iimport it, i found image tables for products, but can't understand the way to add images for categorys? Thank you. Link to comment Share on other sites More sharing options...
PascalVG Posted March 31, 2015 Share Posted March 31, 2015 The function should be: Category::regenerateEntireNtree(); (a public static function) In Back office, I believe add/delete a category or (temporarily) move a category under a new parent and then save it will rebuild the tree structure. (maybe make a category 'tempcat' and put it under any parent. Then save the category. Check if the left and right values are added in the database. Then delete the tempcat afterwards) Hope this helps, pascal. Link to comment Share on other sites More sharing options...
media-x Posted March 31, 2015 Author Share Posted March 31, 2015 (edited) Simple save existing category and works perfectly , many thanks. It's possible to import also images for category? Edited March 31, 2015 by media-x (see edit history) Link to comment Share on other sites More sharing options...
PascalVG Posted March 31, 2015 Share Posted March 31, 2015 Yes, that is possible: To do this, upload the category images to a temporary folder, like: /tmpimg and then use in your csv file as image URL the full path to the image: http://www.yourdomain.com/tmpimg/imagexxx.jpg hope that does the trick. pascal. Link to comment Share on other sites More sharing options...
media-x Posted March 31, 2015 Author Share Posted March 31, 2015 Ok. i understand, i can tell image name already in import of categories, and as told it's a custom script what i write because of complex data structure. Where i have to save this image name from category? Link to comment Share on other sites More sharing options...
PascalVG Posted March 31, 2015 Share Posted March 31, 2015 So, this name of the image (i.e. full path + name) is just one of the columns in your csv file. Then in PrestaShop, you go to import csv, match the columns with the entities in PrestaShop (like first column represents Category Name, 2nd Column is description, etc, etc, and let it import. (N.B. Word of caution: It's always a good idea to backup your database before every import, as a matching mistake is easily made...) Look in the PrestaShop user guide for some more details on importing. Good luck! pascal Link to comment Share on other sites More sharing options...
Wotek Posted April 24, 2015 Share Posted April 24, 2015 I also have a problem with nleft and nright value. I added new category but still value is 0. Help me Link to comment Share on other sites More sharing options...
PascalVG Posted April 26, 2015 Share Posted April 26, 2015 Wotec, Can you just edit any category and then save it (no need to make changes) that should rebuild the tree and add the nleft nright again. Hope that does it. pascal Link to comment Share on other sites More sharing options...
Wotek Posted April 26, 2015 Share Posted April 26, 2015 Hi PascalVGThanks for your reply. i didn't have category with id 1 and parent_id 0 Link to comment Share on other sites More sharing options...
PascalVG Posted April 29, 2015 Share Posted April 29, 2015 Hi Wotec, does that mean t's solved now? You should not have any id = 0, so that sounds OK... 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