Jump to content

root category


croc

Recommended Posts

Hello all,

 

using PS 1.6.0.9. and i tested it and worked. Then I deleted ps_category and ps_product in mysql database.

 

But now I cant in backoffice import csv with categories, i think i deleted also root parent root category cause ps_category is clear now.

 

I tied to create new root category, i tried different dteps but not succeed.

 

Can anybody hlep me what should i do please?

Thanks.

--------------------------------------------------------------------------------------------------------------

 

By importing csv displays this warnig:

 

[PrestaShopException]

Parent category does not exist
at line 374 in file classes/Category.php

368. 		if (!$this->id_parent)369. 			return 0;370. 371. 		$parent_category = new Category((int)$this->id_parent);372. 		if (!Validate::isLoadedObject($parent_category))373. 			throw new PrestaShopException('Parent category does not exist');374. 		return $parent_category->level_depth + 1;375. 	}376. 377. 	/**378. 	  * Re-calculate the values of all branches of the nested tree
Edited by croc (see edit history)
Link to comment
Share on other sites

Once you create a new root category you also have to set its id as root in ps_shop (id_category col)

 

 

Hi nemo1,

 

my root category could named "Home" as was it default after PS instaling.....

 

It means that first i need create in ps_category new row  and then in ps_shop too?

 

 

btw in ps_category are fields:

 

id_category

id_parent

id_shop_default

level_depth

nleft

nright

active

date_add datetime    

date_upd datetime    

position

is_root_category

----------------------------------------------------------------------------------------------------------------------

 

 

 

in ps_shop are fields:

 

id_shop - 1

id_shop_group 1

name - Test

Test id_category   - 2

id_theme  - 2

active  - 1

deleted  - 0

------------------------------------------------------------------------------------------------------------------------------------

 

 

btw actualy ps_category  is clear and ps_shop has 1 item with fields filled in like in the table above 1 1 Test 2 2 1 0

 

1. should i delete it first?

2. then which values should be in all fields of both tables (ps_category + ps_shop)?

 

Thanks for answer

Edited by croc (see edit history)
Link to comment
Share on other sites

if i were you - i will recreate original tree

truncate ps_category table (to recreate auto index), run these 2 queries

INSERT INTO `ps_category` (`id_category`, `id_parent`, `id_shop_default`, `level_depth`, `nleft`, `nright`, `active`, `date_add`, `date_upd`, `position`, `is_root_category`) VALUES (1, 0, 1, 0, 1, 28, 1, '2014-08-15 03:40:15', '2014-08-15 03:40:15', 0, 0);
INSERT INTO `ps_category` (`id_category`, `id_parent`, `id_shop_default`, `level_depth`, `nleft`, `nright`, `active`, `date_add`, `date_upd`, `position`, `is_root_category`) VALUES (2, 1, 1, 1, 2, 27, 1, '2014-08-15 03:40:17', '2014-08-15 03:40:17', 0, 1);
  • Like 1
Link to comment
Share on other sites

 

if i were you - i will recreate original tree

truncate ps_category table (to recreate auto index), run these 2 queries

INSERT INTO `ps_category` (`id_category`, `id_parent`, `id_shop_default`, `level_depth`, `nleft`, `nright`, `active`, `date_add`, `date_upd`, `position`, `is_root_category`) VALUES (1, 0, 1, 0, 1, 28, 1, '2014-08-15 03:40:15', '2014-08-15 03:40:15', 0, 0);
INSERT INTO `ps_category` (`id_category`, `id_parent`, `id_shop_default`, `level_depth`, `nleft`, `nright`, `active`, `date_add`, `date_upd`, `position`, `is_root_category`) VALUES (2, 1, 1, 1, 2, 27, 1, '2014-08-15 03:40:17', '2014-08-15 03:40:17', 0, 1);

 

Hello vekia,

thanks for your help, it moved me little forward, but still not fully succesfully.

 

1. after steps, you suggested me, I get root with id 1   and Home category created too with id 2

2. I imported kategory csv,  the tree on the homepage was visible and in backoffice/ kategories it was created but it was not fully right and there were some mistakes.

3. so I truncated ps_category again, ten imported csv again, a result was that all did seem right in bacoffice /categories and in ps_category , but categories did not display on my homepage after refreshing (i tried it more times and also to import csv again)

4. Then I truncated:

ps_category (i just leave 2 rows which u suggested me Root and Home)

ps_category_group

ps_category_lang

ps_category_shop

ps_category_product

 

5. But all falled down and i cant to log in my backoffice

6. So I imported the rows into all tables above with same values cause i noticed them before :) (but i inserted just rows of Root and Home nothing others)

7. now is the result that i can log into backoffice , i can visit all folders but I just cant log into  Catalog/Categories (firefox told me something about error where the redirection will never ending...)

 

Cold you please help me what should I do now?

Thanks in advance

Edited by croc (see edit history)
Link to comment
Share on other sites

  • 1 month later...
  • 3 months later...

 

Hi

 

 

i must agree with sicakreklam . I have nearly the same problem and I can't find a issue.

Can you help us and put the method you use please?

Must I truncate my Table to create again all my categories?

 

thx

 

 

 

Hi,

 

ps_category_lang

ps_category_shop

 

these should be not clear, edit them IDs

Link to comment
Share on other sites

Hi

There is something I did'nt understood I guess, 'cause I can't fix it.

Everything look right but the Root category is showing itself, I can't create any category, the category tree is not showing anything...

Could you please explain step by step how to do it correctly again?

 

I am in multistore, could the error come from it?

Edited by kingfaya (see edit history)
Link to comment
Share on other sites

Multistore: yeah it definitely might. Do you have at least 1 category? You need a root at least, something you can set the id_category value of ps_shop_url to. So login to the db, check that column of ps_shop_url and set it to one of the categories, ideally the top one

Link to comment
Share on other sites

  • 1 year later...

fix by deleting category

id_category=2

from all mysql tables (ps_category, ps_category_group, ps_category_lang, ps_category_product, ps_category_shop)

and set root

id_category=1 as is_root_category =1

also put parent category (ps_category) on other subcategories assigned before to category 2 ; assign them to parent category 1 after deletion of category2

Link to comment
Share on other sites

×
×
  • Create New...