Jump to content
thirty bees forum

Recommended Posts

Posted

Hi All

I've started work on my new website and thought I would give uploading a few products a test drive.

Anyway I made sure each 1 corresponded to the drop down  and ended up with a 500.. I turned on debug and got a load of errors.. I do have a backup but it was from 7 hours ago now so hoping I can find out what I did wrong.

Or is it easier to just restore as it was working before I did this

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

345.      * @version 1.0.0 Initial version
346.      */
347.     public function setRootCategory($value)
348.     {
349.         if (!Validate::isInt($value)) {
350.             throw new PrestaShopException('Root category must be an integer value');
351.         }
352. 
353.         $this->_root_category = $value;
354. 
355.         return $this;
  • HelperTreeCategoriesCore->setRootCategory - [line 3258 - controllers/admin/AdminProductsController.php] - [1 Arguments]
    3253.             // Generate category selection tree
    3254.             $tree = new HelperTreeCategories('categories-tree', $this->l('Filter by category'));
    3255.             $tree->setAttribute('is_category_filter', (bool) $this->id_current_category)
    3256.                 ->setAttribute('base_url', preg_replace('#&id_category=[0-9]*#', '', static::$currentIndex).'&token='.$this->token)
    3257.                 ->setInputName('id-category')
    3258.                 ->setRootCategory(Category::getRootCategory()->id)
    3259.                 ->setSelectedCategories([(int) $idCategory]);
    3260.             $this->tpl_list_vars['category_tree'] = $tree->render();
    3261. 
    3262.             // used to build the new url when changing category
    3263.             $this->tpl_list_vars['base_url'] = preg_replace('#&id_category=[0-9]*#', '', static::$currentIndex).'&token='.$this->token;
    
  • AdminProductsControllerCore->initContent - [line 262 - classes/controller/Controller.php]
    257.             if (!$this->content_only && ($this->display_header || (isset($this->className) && $this->className))) {
    258.                 $this->initHeader();
    259.             }
    260. 
    261.             if ($this->viewAccess()) {
    262.                 $this->initContent();
    263.             } else {
    264.                 $this->errors[] = Tools::displayError('Access denied.');
    265.             }
    266. 
    267.             if (!$this->content_only && ($this->display_footer || (isset($this->className) && $this->className))) {
    
  • ControllerCore->run - [line 837 - classes/Dispatcher.php]
    832.             if (isset($paramsHookActionDispatcher)) {
    833.                 Hook::exec('actionDispatcher', $paramsHookActionDispatcher);
    834.             }
    835. 
    836.             // Running controller
    837.             $controller->run();
    838.         } catch (PrestaShopException $e) {
    839.             $e->displayMessage();
    840.         }
    841.     }
    842. 
    
  • DispatcherCore->dispatch - [line 63 - admin/index.php]
    58. if (!isset($_REQUEST['controller']) && isset($_REQUEST['tab'])) {
    59.     $_REQUEST['controller'] = strtolower($_REQUEST['tab']);
    60. }
    61. 
    62. // Prepare and trigger admin dispatcher
    63. Dispatcher::getInstance()->dispatch();
    
Posted

An exception during normal operations is always a bug. Back office pages (controllers) should catch any user mistake and display an explaining error message rather than dying ugly.

Could you elaborate a bit more on the steps to reproduce this issue? Which back office page, where to click, and if you could provide the import file used it'd be even better.

Posted

the error is looking for a value of the root category.. it means that the root category is missing in your database

353.         $this->_root_category = $value;
354. 
355.         return $this;

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