0

I've inherited a Magento 2 site and am getting an error when trying to save changes in the dashboard to categories "There has been an error processing your request"

Is the below a theme compatibility error? - we've just updated the site to 2.1.8.

The log for the errors looks like - any pointers much appreciated:

a:4:{i:0;s:349:"Warning: Declaration of Plazathemes\Override\Controller\Adminhtml\Category\Save::imagePreprocessing($data) should be compatible with Magento\Catalog\Controller\Adminhtml\Category\Save::imagePreprocessing(array $data) in /srv/users/serverpilot/apps/red-hot-racing/public/app/code/Plazathemes/Override/Controller/Adminhtml/Category/Save.php on line 82";i:1;s:4499:"#0 /srv/users/serverpilot/apps/red-hot-racing/public/vendor/composer/ClassLoader.php(444): Magento\Framework\App\ErrorHandler->handler(2, 'Declaration of ...', '/srv/users/serv...', 82, Array)
#1 /srv/users/serverpilot/apps/red-hot-racing/public/vendor/composer/ClassLoader.php(444): include()
#2 /srv/users/serverpilot/apps/red-hot-racing/public/vendor/composer/ClassLoader.php(322): Composer\Autoload\includeFile('/srv/users/serv...')
#3 [internal function]: Composer\Autoload\ClassLoader->loadClass('Plazathemes\\Ove...')
#4 [internal function]: spl_autoload_call('Plazathemes\\Ove...')
#5 /srv/users/serverpilot/apps/red-hot-racing/public/vendor/magento/framework/ObjectManager/Relations/Runtime.php(38): class_exists('Plazathemes\\Ove...')
#6 /srv/users/serverpilot/apps/red-hot-racing/public/vendor/magento/framework/Interception/Config/Config.php(153): Magento\Framework\ObjectManager\Relations\Runtime->has('Plazathemes\\Ove...')
#7 /srv/users/serverpilot/apps/red-hot-racing/public/vendor/magento/framework/Interception/Config/Config.php(176): Magento\Framework\Interception\Config\Config->_inheritInterception('Plazathemes\\Ove...')
#8 /srv/users/serverpilot/apps/red-hot-racing/public/vendor/magento/framework/Interception/ObjectManager/Config/Developer.php(61): Magento\Framework\Interception\Config\Config->hasPlugins('Plazathemes\\Ove...')
#9 /srv/users/serverpilot/apps/red-hot-racing/public/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(70): Magento\Framework\Interception\ObjectManager\Config\Developer->getInstanceType('Plazathemes\\Ove...')
#10 /srv/users/serverpilot/apps/red-hot-racing/public/vendor/magento/framework/ObjectManager/ObjectManager.php(57): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Plazathemes\\Ove...', Array)
#11 /srv/users/serverpilot/apps/red-hot-racing/public/vendor/magento/framework/App/ActionFactory.php(40): Magento\Framework\ObjectManager\ObjectManager->create('Magento\\Catalog...')
#12 /srv/users/serverpilot/apps/red-hot-racing/public/vendor/magento/framework/App/Router/Base.php(300): Magento\Framework\App\ActionFactory->create('Magento\\Catalog...')
#13 /srv/users/serverpilot/apps/red-hot-racing/public/vendor/magento/framework/App/Router/Base.php(161): Magento\Framework\App\Router\Base->matchAction(Object(Magento\Framework\App\Request\Http), Array)
#14 /srv/users/serverpilot/apps/red-hot-racing/public/vendor/magento/framework/App/FrontController.php(50): Magento\Framework\App\Router\Base->match(Object(Magento\Framework\App\Request\Http))
#15 /srv/users/serverpilot/apps/red-hot-racing/public/vendor/magento/framework/Interception/Interceptor.php(74): Magento\Framework\App\FrontController->dispatch(Object(Magento\Framework\App\Request\Http))
#16 /srv/users/serverpilot/apps/red-hot-racing/public/vendor/magento/framework/Interception/Chain/Chain.php(70): Magento\Framework\App\FrontController\Interceptor->___callParent('dispatch', Array)
#17 /srv/users/serverpilot/apps/red-hot-racing/public/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Framewo...', 'dispatch', Object(Magento\Framework\App\FrontController\Interceptor), Array, 'install')
#18 /srv/users/serverpilot/apps/red-hot-racing/public/vendor/magento/framework/Module/Plugin/DbStatusValidator.php(69): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#19 /srv/users/serverpilot/apps/red-hot-racing/public/vendor/magento/framework/Interception/Interceptor.php(142): Magento\Framework\Module\Plugin\DbStatusValidator->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#20 /srv/users/serverpilot/apps/red-hot-racing/public/var/generation/Magento/Framework/App/FrontController/Interceptor.php(26): Magento\Framework\App\FrontController\Interceptor->___callPlugins('dispatch', Array, Array)
#21 /srv/users/serverpilot/apps/red-hot-racing/public/vendor/magento/framework/App/Http.php(135): Magento\Framework\App\FrontController\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#22 /srv/users/serverpilot/apps/red-hot-racing/public/vendor/magento/framework/App/Bootstrap.php(258): Magento\Framework\App\Http->launch()
#23 /srv/users/serverpilot/apps/red-hot-racing/public/index.php(39): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http))
#24 {main}";s:3:"url";s:103:"/backoffice/catalog/category/save/key/20527759d571e013532febbcc8fc34bcbca874ffcae29f96e4901cb74fd78569/";s:11:"script_name";s:10:"/index.php";}

The method referenced in the error above:

 /**
 * Image data preprocessing
 *
 * @param array $data
 *
 * @return array
 */
 public function imagePreprocessing($data)
 {
 if (empty($data['image'])) {
 unset($data['image']);
 $data['image']['delete'] = true;
 }
 if (empty($data['thumb_nail'])) {
 unset($data['thumb_nail']);
 $data['thumb_nail']['delete'] = true;
 }
 return $data;
 }
Kyrylo Romantsov
7312 gold badges14 silver badges35 bronze badges
asked Sep 16, 2017 at 12:54
2
  • Show your Plazathemes\Override\Controller\Adminhtml\Category\Save::imagePreprocessing. Commented Sep 16, 2017 at 14:52
  • Thank you for helping :-) I've added the imagePreprocessing method to the question above. Commented Sep 16, 2017 at 15:21

1 Answer 1

1

Replace imagePreprocessing by following code:


/**
 * Image data preprocessing
 *
 * @param array $data
 *
 * @return array
 */
public function imagePreprocessing(array $data)
{
 if (empty($data['image'])) {
 unset($data['image']);
 $data['image']['delete'] = true;
 }
 if (empty($data['thumb_nail'])) {
 unset($data['thumb_nail']);
 $data['thumb_nail']['delete'] = true;
 }
 return $data;
}
answered Sep 16, 2017 at 15:26
1
  • Awesome thank you - a quick fix :-) Is this just something that's changed in latest Mage 2.0 update? Commented Sep 16, 2017 at 15:35

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.