Jump to content

HELP - unable to add products!


Recommended Posts

Hi

 

I am unable to add any products to my store... when I click on the link Catalogue->Products in the back office, it loads:

 

[PrestaShopException]

Root category must be an integer value
at line 212 in file classes/helper/HelperTreeCategories.php

207. }
208.
209. public function setRootCategory($value)
210. {
211. if (!Validate::isInt($value)) {
212. throw new PrestaShopException('Root category must be an integer value');
213. }
214.
215. $this->_root_category = $value;
216. return $this;
217. }

I was able to add products previously. I have made some changes to the social block and the banner since. Please can anyone help me?

 

Thanks a lot

Link to comment
Share on other sites

Thanks a lot for the speedy reply. I am using the newest version of presta with the default theme. I have manually modified a couple of tpl file, but have reverted the changes to test if that was the issue (it wasnt). These tpl relate to the banner block and to adding html to the navbar.

 

Sorry, what is the debug modus?

 

Thanks

Link to comment
Share on other sites

Debug mode is the one that shows you the error, the one you enable like my signature explains. Have a look at ps_shop in your database, see what your root category is.
If that's ok with a category you have. Also, did you modify the adminCategories controller too? Any related tpl?

  • Like 1
Link to comment
Share on other sites

interesting. I cannot open the file, it shows critical error Can't write data to file: there is not enough space on the disk.

Error: Critical file transfer error after transferring 7,838 bytes in 1 second. (this is in Fillezilla FTP).
 
No, I did not modify the above categories.
 
Sorry, I am new to this - where would I find ps_shop in my database please?
Link to comment
Share on other sites

and here is the full text if anyone can help:

 

[PrestaShopException]

Root category must be an integer value
at line 212 in file classes/helper/HelperTreeCategories.php

207. }
208.
209. public function setRootCategory($value)
210. {
211. if (!Validate::isInt($value)) {
212. throw new PrestaShopException('Root category must be an integer value');
213. }
214.
215. $this->_root_category = $value;
216. return $this;
217. }
  • HelperTreeCategoriesCore->setRootCategory - [line 2504 - controllers/admin/AdminProductsController.php] - [1 Arguments]
    2499. // Generate category selection tree
    2500. $tree = new HelperTreeCategories('categories-tree', $this->l('Filter by category'));
    2501. $tree->setAttribute('is_category_filter', (bool)$this->id_current_category)
    2502. ->setAttribute('base_url', preg_replace('#&id_category=[0-9]*#', '', self::$currentIndex).'&token='.$this->token)
    2503. ->setInputName('id-category')
    2504. ->setRootCategory(Category::getRootCategory()->id)
    2505. ->setSelectedCategories(array((int)$id_category));
    2506. $this->tpl_list_vars['category_tree'] = $tree->render();
    2507.
    2508. // used to build the new url when changing category
    2509. $this->tpl_list_vars['base_url'] = preg_replace('#&id_category=[0-9]*#', '', self::$currentIndex).'&token='.$this->token;
  • AdminProductsControllerCore->initContent - [line 189 - classes/controller/Controller.php]
    184. if (!$this->content_only && ($this->display_header || (isset($this->className) && $this->className))) {
    185. $this->initHeader();
    186. }
    187.
    188. if ($this->viewAccess()) {
    189. $this->initContent();
    190. } else {
    191. $this->errors[] = Tools::displayError('Access denied.');
    192. }
    193.
    194. if (!$this->content_only && ($this->display_footer || (isset($this->className) && $this->className))) {
  • ControllerCore->run - [line 367 - classes/Dispatcher.php]
    362. if (isset($params_hook_action_dispatcher)) {
    363. Hook::exec('actionDispatcher', $params_hook_action_dispatcher);
    364. }
    365.
    366. // Running controller
    367. $controller->run();
    368. } catch (PrestaShopException $e) {
    369. $e->displayMessage();
    370. }
    371. }
    372.
  • DispatcherCore->dispatch - [line 58 - admin/index.php]
    53. if (!isset($_REQUEST['controller']) && isset($_REQUEST['tab'])) {
    54. $_REQUEST['controller'] = strtolower($_REQUEST['tab']);
    55. }
    56.
    57. // Prepare and trigger admin dispatcher
    58. Dispatcher::getInstance()->dispatch();
Link to comment
Share on other sites

Seems your webspace is added with quotas and you already reached the maximum of it.

 

 

 

interesting. I cannot open the file, it shows critical error Can't write data to file: there is not enough space on the disk.

 

 

You should contact your provider in this case and verify what is happening.

Link to comment
Share on other sites

  • 2 weeks later...

Hi, i have the same problem: Root category must be an integer value at line 212

I'm very newbie in PrestaShop and i dont know what is the problem.

 

I re-add "Home category" that i erased and it's still  not working.

I searched "ps_shop" like mentioned and i didn't find it.

 

Could you help me please ?

Link to comment
Share on other sites

Hi I have the same error. It hapened when I manualy import bazes from my old one store. I have import one by one categories by phpmyadmin. Now haven't root directory. I have restore all ps-tables in original view but have the same result.

there are 5:

ps_category
ps_category_group

ps_category_lang

ps_category_product

ps_category_shop

 

all of them I have re inport like original but same error
Have you some ideas?

 

Thank you

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

  • 4 weeks later...

Hi, i'm facing same problem - "Fatal error: Call to a member function setRootCategory() on a non-object in /home/ultimate/public_html/furnizorul-dvs.ro/controllers/admin/AdminProductsController.php on line 2504"  i used the PS-cleaner to empty all the demo products/categories but when i tried to access the catalog/Products it returns that error... i've changed the PS_SHOP id_category to 1 still same issue

Link to comment
Share on other sites

  • 3 weeks later...

I have the same error everytime I do Catalog -> Products.

 

I am on the Cloud version.

 

And I can get to products from each separate store... in the drop down ..

 

But when I go to all stores, Products .. I get.

 

 

[PrestaShopException]

Root category must be an integer value
at line 212 in file core/www/core_1.6.1.3/classes/helper/HelperTreeCategories.php

207. }
208.
209. public function setRootCategory($value)
210. {
211. if (!Validate::isInt($value)) {
212. throw new PrestaShopException('Root category must be an integer value');
213. }
214.
215. $this->_root_category = $value;
216. return $this;
217. }
Link to comment
Share on other sites

Sounds like someone deleted or renamed Root and Home categories, there are several places in the database that these must match  ps_category tables and ps_configuration.

 

Here is the tables from a fresh install that should reset you categories to their correct values, copy and then paste into the SQL section of your database.

(copy everything in blue)

 

 

 

 

 

--
-- Table structure for table `pr_category`
--
 
DROP TABLE IF EXISTS `pr_category`;
CREATE TABLE IF NOT EXISTS `pr_category` (
  `id_category` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `id_parent` int(10) unsigned NOT NULL,
  `id_shop_default` int(10) unsigned NOT NULL DEFAULT '1',
  `level_depth` tinyint(3) unsigned NOT NULL DEFAULT '0',
  `nleft` int(10) unsigned NOT NULL DEFAULT '0',
  `nright` int(10) unsigned NOT NULL DEFAULT '0',
  `active` tinyint(1) unsigned NOT NULL DEFAULT '0',
  `date_add` datetime NOT NULL,
  `date_upd` datetime NOT NULL,
  `position` int(10) unsigned NOT NULL DEFAULT '0',
  `is_root_category` tinyint(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id_category`),
  KEY `category_parent` (`id_parent`),
  KEY `nleftrightactive` (`nleft`,`nright`,`active`),
  KEY `level_depth` (`level_depth`),
  KEY `nright` (`nright`),
  KEY `activenleft` (`active`,`nleft`),
  KEY `activenright` (`active`,`nright`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=12 ;
 
--
-- Dumping data for table `pr_category`
--
 
INSERT INTO `pr_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, 4, 1, '2016-01-10 23:16:17', '2016-01-10 23:16:17', 0, 0),
(2, 1, 1, 1, 2, 3, 1, '2016-01-10 23:16:17', '2016-01-10 23:16:17', 0, 1);
 
-- --------------------------------------------------------
 
--
-- Table structure for table `pr_category_group`
--
 
DROP TABLE IF EXISTS `pr_category_group`;
CREATE TABLE IF NOT EXISTS `pr_category_group` (
  `id_category` int(10) unsigned NOT NULL,
  `id_group` int(10) unsigned NOT NULL,
  PRIMARY KEY (`id_category`,`id_group`),
  KEY `id_category` (`id_category`),
  KEY `id_group` (`id_group`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
--
-- Dumping data for table `pr_category_group`
--
 
INSERT INTO `pr_category_group` (`id_category`, `id_group`) VALUES
(2, 1),
(2, 2),
(2, 3);
 
-- --------------------------------------------------------
 
--
-- Table structure for table `pr_category_lang`
--
 
DROP TABLE IF EXISTS `pr_category_lang`;
CREATE TABLE IF NOT EXISTS `pr_category_lang` (
  `id_category` int(10) unsigned NOT NULL,
  `id_shop` int(11) unsigned NOT NULL DEFAULT '1',
  `id_lang` int(10) unsigned NOT NULL,
  `name` varchar(128) NOT NULL,
  `description` text,
  `link_rewrite` varchar(128) NOT NULL,
  `meta_title` varchar(128) DEFAULT NULL,
  `meta_keywords` varchar(255) DEFAULT NULL,
  `meta_description` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id_category`,`id_shop`,`id_lang`),
  KEY `category_name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
--
-- Dumping data for table `pr_category_lang`
--
 
INSERT INTO `pr_category_lang` (`id_category`, `id_shop`, `id_lang`, `name`, `description`, `link_rewrite`, `meta_title`, `meta_keywords`, `meta_description`) VALUES
(1, 1, 1, 'Root', '', 'root', '', '', ''),
(2, 1, 1, 'Home', '', 'home', '', '', '');
 
-- --------------------------------------------------------
 
--
-- Table structure for table `pr_category_shop`
--
 
DROP TABLE IF EXISTS `pr_category_shop`;
CREATE TABLE IF NOT EXISTS `pr_category_shop` (
  `id_category` int(11) NOT NULL,
  `id_shop` int(11) NOT NULL,
  `position` int(10) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id_category`,`id_shop`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
--
-- Dumping data for table `pr_category_shop`
--
 
INSERT INTO `pr_category_shop` (`id_category`, `id_shop`, `position`) VALUES
(1, 1, 0),
(2, 1, 0);
 
-- --------------------------------------------------------
 
 
 
 
 
 
 
 
Then check your ps_configuration table, look for the values below and make sure the values are as below.
 
PS_ROOT_CATEGORY   1  
PS_HOME_CATEGORY   2 
 
 
 
Not sure this will change anything but ps_shop should be like this, shop name should be your shops name, the values are the real concern here.
 
(1, 1, 'shop'' name', 2, 1, 1, 0);

 

 

 

No real experience with Prestashop cloud but if you disable MultiStore does the issue persist.

 

Hope this helps

  • Like 1
Link to comment
Share on other sites

I did manage to get it back working.   Went to all stores...on the top of the mulistore.

 

Went to categories... and went to a category.  

 

then manually changed the url so I would go to category 1.

 

It came up with no name.  I added root.

 

And saved...

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