Skip to content

Cannot save attribute #8202

Closed
Closed
@maximehuran

Description

@maximehuran

Preconditions

  1. Have an attribute with a source model Magento\Eav\Model\Entity\Attribute\Source\Boolean
  2. Have it's frontend_input with "select".

Steps to reproduce

  1. Go in backend and try to save the attribute

Expected result

  1. The attribute must be saved with success

Actual result

  1. Error 500 :
1 exception(s):
Exception #0 (Exception): Notice: Undefined index: value in /var/www/preprod/vendor/magento/module-catalog/Controller/Adminhtml/Product/Attribute/Validate.php on line 155

Exception #0 (Exception): Notice: Undefined index: value in /var/www/preprod/vendor/magento/module-catalog/Controller/Adminhtml/Product/Attribute/Validate.php on line 155
#0 /var/www/preprod/vendor/magento/module-catalog/Controller/Adminhtml/Product/Attribute/Validate.php(155): Magento\Framework\App\ErrorHandler->handler(8, 'Undefined index...', '/var/www/prepro...', 155, Array)
#1 /var/www/preprod/vendor/magento/module-catalog/Controller/Adminhtml/Product/Attribute/Validate.php(108): Magento\Catalog\Controller\Adminhtml\Product\Attribute\Validate->checkUniqueOption(Object(Magento\Framework\DataObject), Array)
#2 /var/www/preprod/var/generation/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Validate/Interceptor.php(24): Magento\Catalog\Controller\Adminhtml\Product\Attribute\Validate->execute()
#3 /var/www/preprod/vendor/magento/framework/App/Action/Action.php(102): Magento\Catalog\Controller\Adminhtml\Product\Attribute\Validate\Interceptor->execute()
#4 /var/www/preprod/vendor/magento/module-backend/App/AbstractAction.php(226): Magento\Framework\App\Action\Action->dispatch(Object(Magento\Framework\App\Request\Http))
#5 /var/www/preprod/vendor/magento/module-catalog/Controller/Adminhtml/Product/Attribute.php(79): Magento\Backend\App\AbstractAction->dispatch(Object(Magento\Framework\App\Request\Http))
#6 /var/www/preprod/vendor/magento/framework/Interception/Interceptor.php(74): Magento\Catalog\Controller\Adminhtml\Product\Attribute->dispatch(Object(Magento\Framework\App\Request\Http))
#7 /var/www/preprod/vendor/magento/framework/Interception/Chain/Chain.php(70): Magento\Catalog\Controller\Adminhtml\Product\Attribute\Validate\Interceptor->___callParent('dispatch', Array)
#8 /var/www/preprod/vendor/magento/framework/Interception/Chain/Chain.php(63): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Catalog...', 'dispatch', Object(Magento\Catalog\Controller\Adminhtml\Product\Attribute\Validate\Interceptor), Array, 'adminAuthentica...')
#9 /var/www/preprod/vendor/magento/module-backend/App/Action/Plugin/Authentication.php(143): Magento\Framework\Interception\Chain\Chain->Magento\Framework\Interception\Chain\{closure}(Object(Magento\Framework\App\Request\Http))
#10 /var/www/preprod/vendor/magento/framework/Interception/Chain/Chain.php(67): Magento\Backend\App\Action\Plugin\Authentication->aroundDispatch(Object(Magento\Catalog\Controller\Adminhtml\Product\Attribute\Validate\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#11 /var/www/preprod/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Catalog...', 'dispatch', Object(Magento\Catalog\Controller\Adminhtml\Product\Attribute\Validate\Interceptor), Array, 'adminMassaction...')
#12 /var/www/preprod/vendor/magento/module-backend/App/Action/Plugin/MassactionKey.php(33): Magento\Catalog\Controller\Adminhtml\Product\Attribute\Validate\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#13 /var/www/preprod/vendor/magento/framework/Interception/Interceptor.php(142): Magento\Backend\App\Action\Plugin\MassactionKey->aroundDispatch(Object(Magento\Catalog\Controller\Adminhtml\Product\Attribute\Validate\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#14 /var/www/preprod/var/generation/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Validate/Interceptor.php(39): Magento\Catalog\Controller\Adminhtml\Product\Attribute\Validate\Interceptor->___callPlugins('dispatch', Array, Array)
#15 /var/www/preprod/vendor/magento/framework/App/FrontController.php(55): Magento\Catalog\Controller\Adminhtml\Product\Attribute\Validate\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#16 /var/www/preprod/vendor/magento/framework/Interception/Interceptor.php(74): Magento\Framework\App\FrontController->dispatch(Object(Magento\Framework\App\Request\Http))
#17 /var/www/preprod/vendor/magento/framework/Interception/Chain/Chain.php(70): Magento\Framework\App\FrontController\Interceptor->___callParent('dispatch', Array)
#18 /var/www/preprod/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Framewo...', 'dispatch', Object(Magento\Framework\App\FrontController\Interceptor), Array, 'install')
#19 /var/www/preprod/vendor/magento/framework/Module/Plugin/DbStatusValidator.php(69): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#20 /var/www/preprod/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))
#21 /var/www/preprod/var/generation/Magento/Framework/App/FrontController/Interceptor.php(26): Magento\Framework\App\FrontController\Interceptor->___callPlugins('dispatch', Array, Array)
#22 /var/www/preprod/vendor/magento/framework/App/Http.php(135): Magento\Framework\App\FrontController\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#23 /var/www/preprod/vendor/magento/framework/App/Bootstrap.php(258): Magento\Framework\App\Http->launch()
#24 /var/www/preprod/index.php(39): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http))
#25 {main}

Magento goes on the class :
Magento\Catalog\Controller\Adminhtml\Product\Attribute\Validate
In the method : checkUniqueOption

/**
     * @param DataObject $response
     * @param array|null $options
     */
    private function checkUniqueOption(DataObject $response, array $options = null)
    {
        if (is_array($options) && !$this->isUniqueAdminValues($options['value'], $options['delete'])) {
            $this->setMessageToResponse($response, [__('The value of Admin must be unique.')]);
            $response->setError(true);
        }
    }

But $options['value'] doesn't exist.
Why ? Because on the backend the form disable the inputs :

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions