Jump to content

Error: Id must be filled for categories tree


Recommended Posts

Hello,

 

I started using Prestashop 2 weeks ago and I am finding it easy work with. I added a few categories and it was ok. I started products, now I have about 30 products. But at the moment when I attempt to create a new category I receive this error:

 

[PrestaShopException]

Id must be filled for categories tree
at line 97 in file classes/helper/HelperForm.php

92. 					{
93. 						case 'categories':
94. 							if ($categories)
95. 							{
96. 									if (!isset($params['tree']['id']))
97. 									throw new PrestaShopException('Id must be filled for categories tree');
98. 								
99. 								$tree = new HelperTreeCategories($params['tree']['id'], isset($params['tree']['title']) ? $params['tree']['title'] : null);
100. 
101. 								if (isset($params['name']))
102. 									$tree->setInputName($params['name']);

I searched the internet I found that I can comment this 96/97 lines, which makes it ok but it is still very disordered. Could you tell me what the problem might be and how it can be fixed?

 

Thanks in advance.

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...
  • 1 month later...

Had this error as well... here is what helped me (I upgraded from a 1.5.6er version)

 

 

Check if you have an "override" of AdminCategoriesController.php in /override/controllers/admin/

 

if yes, please look into this file and search for a "renderForm" method. If this method exits, you are propably using an outdated module.

 

The code in 1.6 changed a bit and the form generation is a little bit different.

Make sure you find this:

array(
'type'  => 'categories',
'label' => $this->l('Parent category'),
'name'  => 'id_parent',
'tree'  => array(
		'id'                  => 'categories-tree',
		'selected_categories' => $selected_categories,
	        'disabled_categories' => (!Tools::isSubmit('add'.$this->table) && !Tools::isSubmit('submitAdd'.$this->table)) ? array($this->_category->id) : null
					)
				),

and not this:

	array(
								'type' => 'categories',
								'label' => $this->l('Parent category:'),
								'name' => 'id_parent',
								'values' => array(
										'trads' => array(
												'Root' => $root_category,
												'selected' => $this->l('Selected'),
												'Collapse All' => $this->l('Collapse All'),
												'Expand All' => $this->l('Expand All')
										),
										'selected_cat' => $selected_cat,
										'input_name' => 'id_parent',
										'use_radio' => true,
										'use_search' => false,
										'disabled_categories' => array(4),
										'top_category' => Category::getTopCategory(),
										'use_context' => true,
								)
						),

Hope this helps ...

  • Like 2
Link to comment
Share on other sites


                array(
                    'type' => 'categories',
                    'label' => $this->l('Parent category:'),
                    'name' => 'id_parent',
                    'values' => array(
                        'trads' => array(
                            'Root' => $root_category,
                            'selected' => $this->l('selected'),
                            'Collapse All' => $this->l('Collapse All'),
                            'Expand All' => $this->l('Expand All')
                        ),
                        'selected_cat' => $selected_cat,
                        'input_name' => 'id_parent',
                        'use_radio' => TRUE,
                        'use_search' => FALSE,
                        'disabled_categories' => array(4),
                        'top_category' => Category::getTopCategory(),
                        'use_context' => TRUE,
                    )
                ),

Hello,this is what i have.

But look after delete the dolibarr module (unistall) my backend was unaccesible,(did an full restore with my isp hosting)i think it also that some module that does it do,but donn't know wich one.

Can i do anything else?

Thank you

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

You don't have to delete the module. Just replace the code you found with

array(
'type'  => 'categories',
'label' => $this->l('Parent category'),
'name'  => 'id_parent',
'tree'  => array(
	'id'                  => 'categories-tree',
	'selected_categories' => $selected_categories,
	 'disabled_categories' => (!Tools::isSubmit('add'.$this->table) && !Tools::isSubmit('submitAdd'.$this->table)) ? array($this->_category->id) : null
	)
),
Link to comment
Share on other sites

  • 1 month later...

I have the same problem.
Using Version 1.6.0.14

The code you mention do not enecuentro in HelperForm.php file.

You can tell me the line number where the replacement of code posted in # 7 should be done?

 

Regards

 

Reread all again and I realized I was looking in the wrong file.

Segui's intruciocnes of Pete78 and the problem was solved, however, the presentation of the interface does not look good. Then that's what I will review.

Thanks for the help.

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

  • 2 months later...

I had the same problem.

using prestashop 1.6.1.1 and the default shop front all was ok, modified the shop front still all ok, then I bought a shop front from prestacrea and had this issue

contacted there help and they said it was a presta problem and not theirs, odd that i never had it until I used their shop front.

 

Followed the instructions above and it worked so thank you to Pete78

My only add on is make sure you follow the path he tells you in post number 5

as there is another folder admin/controllers/

and you need the folder

/override/controllers/admin/AdminCategoriesController.php

Link to comment
Share on other sites

  • 3 months later...
  • 1 year later...
  • 9 months later...

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...