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 :
@maximehuran thank you for your report.
Please, also identify which version of Magento you are running.
Oh sorry. My Magento version is 2.1.3
Le ven. 20 janv. 2017 Ã 09:36, Olga Moyseyenko notifications@github.com a
écrit :
@maximehuran https://github.com/maximehuran thank you for your report.
Please, also identify which version of Magento you are running.—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/magento/magento2/issues/8202#issuecomment-274009824,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AK2nk68-U5JZb0uK5StAmYaH9DWS7GhQks5rUHIGgaJpZM4LoXwF
.
This issue is with Magento2.1.3. I am also facing this when trying to add a new option value to 'color' attribute and saving. Error is 'The value of Admin must be unique.' (I am sure what i am inserting is unique)
@veloraven I am also having the same issue when trying to add a new option to a multiple select attribute. I get the same error message @wclabhinav has indicated.
Other are also having this issue:
http://magento.stackexchange.com/questions/152845/manufacturer-problem-by-adding-brand-name
@maximehuran Can something be changed in the magento database to allow an affected attribute to save? Do you know of any workaround?
Not only can I not save new option values to this attribute, I cannot save the old ones either...sure they are still there when the attribute is opened but trying to save the attribute again even if nothing is added yields the same error The value of Admin must be unique.
I do not see any issues in the following tables:
eav_attribute_option
eav_attribute_option_value
To my knowledge if you upgrade form 2.1.2 to 2.1.3, before adding a new option value to a product attribute, if you open and save the product attribute first, you may be able to add option values later without this error occurring. But falling short of this process you can get stuck with this ticket issue.
UPDATE: Managed to figure this out. There was one repeat option in a list of many, many options. deleting it now allows me to save the product attribute.
same issue in 2.1.4
I think that 2.1.3 added in some validation to ensure that multiple matching values were not entered as options. That meant that if duplicates already existed then suddenly you could not save the attribute. The only option is to remove duplicates and then you should be able to save. The good news is that you should not get this issue again because of the additional validation.
Same issue in 2.1.5 which is expected.
Remove the duplicates from which table?
I had the same issue with 2.1.4 but could not find the cause.
The ugly workaround for me was to modify core temporarily:
diff -r ff0ac299b1dc www/vendor/magento/module-catalog/Controller/Adminhtml/Product/Attribute/Validate.php
--- a/www/vendor/magento/module-catalog/Controller/Adminhtml/Product/Attribute/Validate.php Tue Mar 07 23:25:16 2017 +0100
+++ b/www/vendor/magento/module-catalog/Controller/Adminhtml/Product/Attribute/Validate.php Wed Mar 08 12:30:27 2017 +0100
@@ -152,7 +152,7 @@
*/
private function checkUniqueOption(DataObject $response, array $options = null)
{
- if (is_array($options) && !$this->isUniqueAdminValues($options['value'], $options['delete'])) {
+ if (is_array($options) && !$this->isUniqueAdminValues(@(array)$options['value'], $options['delete'])) {
$this->setMessageToResponse($response, [__('The value of Admin must be unique.')]);
$response->setError(true);
}
hi @maximehuran , i try to reproduce your bug without success, can you write more steps to reproduce.
Got the same problem in Magento 2.1.4, cannot save or change or add values of the attribute
Hi, as @maximehuran pointed out, this is happening for system generated attributes (such an attribute added programmatically) when the attribute is select and the options are not editable. I have this in the update schema script:
/**
* Adds finance EAV fields to product
* @param ModuleDataSetupInterface $setup
* @return void
*/
private function _1_0_2_AddProductAttributes($setup)
{
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
$eavSetup->addAttribute(
Product::ENTITY,
'paybyfinance_enable',
[
'group' => 'Hitachi PaybyFinance',
'type' => 'int',
'backend' => '',
'frontend' => '',
'label' => 'Enable Hitachi PaybyFinance',
'input' => 'select',
'class' => '',
'source' => '\Hitachi\PaybyFinance\Model\Entity\Attribute\Source\EnablePaybyfinance',
'global' => ScopedAttributeInterface::SCOPE_GLOBAL,
'visible' => true,
'required' => true,
'user_defined' => false,
'default' => EnablePaybyfinance::VALUE_CONFIGURATION,
'searchable' => false,
'filterable' => false,
'comparable' => false,
'visible_on_front' => false,
'used_in_product_listing' => true,
'unique' => false,
'apply_to' => ''
]
);
}
And here is the return array from the source class:
/**
* Retrieve all options array
*
* @return String[]
*/
public function getAllOptions()
{
if ($this->_options === null) {
$this->_options = [
['label' => __('Use Configuration'), 'value' => self::VALUE_CONFIGURATION],
['label' => __('Force Enable'), 'value' => self::VALUE_FORCE_ENABLE],
['label' => __('Force Disable'), 'value' => self::VALUE_FORCE_DISABLE],
];
}
return $this->_options;
}
Hope this helps. The solution @cih997 suggested works, but I think it would be better to not pass this parameter at all from JS.
Still issue in Magento 2.1.6 EE version, anyone have solution??
I had the same problem with one of the Product Attributes. To fix the problem I run the query:
SELECT * FROM `mgbe_eav_attribute_option_value` where option_id in (SELECT option_id FROM `mgbe_eav_attribute_option` where attribute_id=81) ORDER BY `mgbe_eav_attribute_option_value`.`value` ASC
(you need to replace 81 with proper id - you can get it from the url from admin panel catalog/product_attribute/edit/attribute_id/81/key/....)
and then just looked at the result and removed duplicates. I also had to remove corresponding values from mgbe_eav_attribute_option
(based on option_id field)
After removing all duplicates I was able to save Options
@amarnik The query returned 0 results in my case.
I am having the issue on Magento CE 2.1.7 with the following attribute:
$eavSetup->addAttribute(\Magento\Catalog\Model\Product::ENTITY, 'my_code', [
'type' => 'varchar',
'backend' => 'Magento\Catalog\Model\Product\Attribute\Backend\Boolean',
'frontend' => '',
'label' => 'My Label',
'input' => 'select',
'required' => false,
'global' => false,
'visible_on_front' => false,
'visible' => true,
'used_in_product_listing' => true,
'searchable' => false,
'filterable' => false,
'source' => 'Magento\Eav\Model\Entity\Attribute\Source\Boolean'
]);
Happens when I try to change the value for "used_in_product_listing" in the backend.
i had tried to solve this by removing duplicate entry on eav_attribute_option_value and also with changing in Magento\Catalog\Controller\Adminhtml\Product\Attribute\Validate
In the method : checkUniqueOption
private function checkUniqueOption(DataObject $response, array $options = null)
but both doesn't worked for me
Please help
Thanks
Hi there, we had the same issue. The reason in our case was that one of the entries were entered twice. When removing the double entry we could save the attribute. Hope this helps. Version 2.1.7
In lower versions, there was a bug in which users were able to save duplicate data in CMS (Maybe validation wasn't working). Later, in version lower than 2.1.3, above mentioned error was popped as magento have resolved validation issue but not have resolved duplicate entry issue (duplicate entries were still there with different primary keys in db, however users were not able to insert NEW duplicates). Now from v 2.1.4 both these bugs have been resolved and now you need to find duplicate entries manually and delete one of them and insert new options as well.
If it can help anyone, here is a SQL query to identify duplicates:
SELECT *
FROM eav_attribute_option_value AS a
INNER JOIN eav_attribute_option AS ao USING (option_id)
INNER JOIN (
SELECT b.store_id, b.value_id, b.value, b.option_id, bo.attribute_id
FROM eav_attribute_option_value AS b
INNER JOIN eav_attribute_option AS bo USING (option_id)
) AS b ON ao.attribute_id = b.attribute_id
WHERE
a.value_id != b.value_id
AND a.store_id = b.store_id
AND a.value = b.value
@maximehuran, thank you for your report.
We were not able to reproduce this issue by following the steps you provided. If you'd like to update it, please reopen the issue.
We tested the issue on 2.3.0, 2.2.0, 2.1.9
How can I safely remove duplicates without losing values in products?
I have the same issue for Magento ver. 2.1.6
Example of values for table eav_attribute_option_value
- http://joxi.ru/Y2Ly9PNh9YPYXA
Can anyone help or give advice, please?
It runs when I'm installing Magento.
php /var/www/html/bin/magento setup:install
But: php /var/www/html/bin/magento setup:upgrade
throws the error.
Try to set deploy mode to production and run setup scripts.
@maximehuran I've also this error in 2.1.7 version, it's caused because (as you pointed above) the value input is disabled, but the "delete" hidden input is not disabled.
We've fixed it disabling it when necessary (as M2 does by default for the other inputs):
(This code is for Magento_Catalog module)
Index: view/adminhtml/templates/catalog/product/attribute/options.phtml
<+>UTF-8
===================================================================
--- view/adminhtml/templates/catalog/product/attribute/options.phtml
+++ view/adminhtml/templates/catalog/product/attribute/options.phtml
@@ -98,7 +98,11 @@
</td>
<?php endforeach; ?>
<td id="delete_button_container_<%- data.id %>" class="col-delete">
- <input type="hidden" class="delete-flag" name="option[delete][<%- data.id %>]" value="" />
+ <input type="hidden" class="delete-flag" name="option[delete][<%- data.id %>]" value=""
+ <?php if ($block->getReadOnly() || $block->canManageOptionDefaultOnly()): ?>
+ disabled="disabled"
+ <?php endif; ?>
+ />
<?php if (!$block->getReadOnly() && !$block->canManageOptionDefaultOnly()):?>
<button
id="delete_button_<%- data.id %>"
We experienced same error in v2.1.5. and had fixed this problem after updating a value in PHP configuration as below.
; How many GET/POST/COOKIE input variables may be accepted
max_input_vars = 10000
Most helpful comment
If it can help anyone, here is a SQL query to identify duplicates: