Magento2: 2.1.3 CE - Unable to set attribute set for new product (possibly data-migration issue)

Created on 15 Dec 2016  路  18Comments  路  Source: magento/magento2


Preconditions


  1. Magento 2.1.3 CE (from Composer)
  2. PHP v7.0.14 Apache

This was a 2.1.2 install which was then upgraded to 2.1.3 before any products/attributes were setup. Products/attributes were imported from 1.7.0.2 using the data-migration-tool.

Steps to reproduce

  1. Create an attribute set (I'm using some imported from Magento 1.7)
  2. Go to Products->Catalog and Select "Add Product" and Simple Product (Configurable Product also fails, not tested another). URL is currently https://XXXX/catalog/product/new/set/21/type/simple/key/KEY/
  3. Change the "Attribute Set" dropdown from Default to anything else.
    A POST call is made to:
    https://XXXX/admin/catalog/product/reload/type/simple/store/0/popup/1/componentJson/1/prev_set_id/21/key/KEY/?set=15&isAjax=true
    [post data includes a form_key and returns 181Kb of JSON]
    another POST is made to:
    https://XXXX/admin/catalog/product/reload/type/simple/store/0/popup/1/componentJson/1/prev_set_id/15/key/KEY/?set=undefined&isAjax=true
    which fails with a 503 Service Unavailable code
    [post data includes a form_key and returns a standard "There has been an error processing your request" with the corresponding var/report file containing:
a:4:{i:0;s:37:"attribute_set_id is a required field.";i:1;s:4163:"#0 /WEBROOT/vendor/magento/module-eav/Model/Attribute/GroupRepository.php(111): Magento\Framework\Exception\InputException::requiredField('attribute_set_i...')
#1 /WEBROOT/vendor/magento/module-catalog/Model/ProductAttributeGroupRepository.php(57): Magento\Eav\Model\Attribute\GroupRepository->getList(Object(Magento\Framework\Api\SearchCriteria))
#2 /WEBROOT/vendor/magento/module-catalog/Ui/DataProvider/Product/Form/Modifier/Eav.php(426): Magento\Catalog\Model\ProductAttributeGroupRepository->getList(Object(Magento\Framework\Api\SearchCriteria))
#3 /WEBROOT/vendor/magento/module-catalog/Ui/DataProvider/Product/Form/Modifier/Eav.php(241): Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\Eav->getGroups()
#4 /WEBROOT/vendor/magento/module-catalog/Ui/DataProvider/Product/Form/ProductDataProvider.php(68): Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\Eav->modifyMeta(Array)
#5 /WEBROOT/vendor/magento/framework/View/Element/UiComponentFactory.php(269): Magento\Catalog\Ui\DataProvider\Product\Form\ProductDataProvider->getMeta()
#6 /WEBROOT/vendor/magento/framework/View/Element/UiComponentFactory.php(164): Magento\Framework\View\Element\UiComponentFactory->mergeMetadata('product_form', Array, false)
#7 /WEBROOT/vendor/magento/framework/View/Layout/Generator/UiComponent.php(124): Magento\Framework\View\Element\UiComponentFactory->create('product_form', NULL, Array)
#8 /WEBROOT/vendor/magento/framework/View/Layout/Generator/UiComponent.php(93): Magento\Framework\View\Layout\Generator\UiComponent->generateComponent(Object(Magento\Framework\View\Layout\Data\Structure), 'product_form', Array, Object(Magento\Framework\View\Layout\Interceptor))
#9 /WEBROOT/vendor/magento/framework/View/Layout/GeneratorPool.php(86): Magento\Framework\View\Layout\Generator\UiComponent->process(Object(Magento\Framework\View\Layout\Reader\Context), Object(Magento\Framework\View\Layout\Generator\Context))
#10 /WEBROOT/vendor/magento/framework/View/Layout.php(327): Magento\Framework\View\Layout\GeneratorPool->process(Object(Magento\Framework\View\Layout\Reader\Context), Object(Magento\Framework\View\Layout\Generator\Context))
#11 /WEBROOT/var/generation/Magento/Framework/View/Layout/Interceptor.php(89): Magento\Framework\View\Layout->generateElements()
#12 /WEBROOT/vendor/magento/framework/View/Layout/Builder.php(129): Magento\Framework\View\Layout\Interceptor->generateElements()
#13 /WEBROOT/vendor/magento/framework/View/Layout/Builder.php(65): Magento\Framework\View\Layout\Builder->generateLayoutBlocks()
#14 /WEBROOT/vendor/magento/framework/View/Layout.php(244): Magento\Framework\View\Layout\Builder->build()
#15 /WEBROOT/vendor/magento/framework/View/Layout.php(935): Magento\Framework\View\Layout->build()
#16 /WEBROOT/var/generation/Magento/Framework/View/Layout/Interceptor.php(492): Magento\Framework\View\Layout->getOutput()
#17 /WEBROOT/vendor/magento/framework/View/Result/Layout.php(181): Magento\Framework\View\Layout\Interceptor->getOutput()
#18 /WEBROOT/vendor/magento/framework/View/Result/Layout.php(164): Magento\Framework\View\Result\Layout->render(Object(Magento\Framework\App\Response\Http\Interceptor))
#19 /WEBROOT/var/generation/Magento/Framework/View/Result/Layout/Interceptor.php(89): Magento\Framework\View\Result\Layout->renderResult(Object(Magento\Framework\App\Response\Http\Interceptor))
#20 /WEBROOT/vendor/magento/framework/App/Http.php(139): Magento\Framework\View\Result\Layout\Interceptor->renderResult(Object(Magento\Framework\App\Response\Http\Interceptor))
#21 /WEBROOT/vendor/magento/framework/App/Bootstrap.php(258): Magento\Framework\App\Http->launch()
#22 /WEBROOT/index.php(39): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http))
#23 {main}";s:3:"url";s:192:"/XXXX/catalog/product/reload/type/configurable/store/0/popup/1/componentJson/1/prev_set_id/16/key/9b342c123e56ef9b1123af9d7cc8711bb6206efb3f693d9f74d1028b926d8834/?set=undefined&isAjax=true";s:11:"script_name";s:10:"/index.php";}

another POST is made to:
https://XXXX/admin/catalog/product/reload/type/simple/store/0/popup/1/componentJson/1/prev_set_id/15/key/KEY/?set=&isAjax=true
which fails with a 404 Forbidden code (and HTML is returned)

Expected result

  1. The list of attributes is updated

Actual result

  1. The "Please wait" spinner continues to show.

Fixed in 2.3.x Clear Description Confirmed Format is valid Ready for Work Reproduced on 2.1.x Reproduced on 2.2.x bug report

Most helpful comment

Moving price attribute to Product Details Tab resolved this issue for me.

This issue was a bit brain-teaser. We had found a temporary workaround - Duplicate the product & make the changes and this issue does not happen.

All 18 comments

I've just tried creating a new Attribute Set based on "Default" (which has no modifications) with no additional settings - and I was able to switch to this attribute set without problems (switching to an imported one still has issues).

I then tried adding an imported attribute to the new attribute set and retried "Add Product" and this succeeded.

Continuing to investigate when I can, but looks like something faulted during import.

Adding all the attributes to the "new" attribute set and I am able to create a new product with that attribute set. I'm still unable to create products with the existing (migrated) attribute sets. Modifying existing products using those sets works correctly.

I had this issue as well.

Two parts to fix:

My attribute sets were missing the "schedule design update" tab and the attributes;
I used this [even though it was for enterprise] and it worked.
https://github.com/magento/magento2/issues/5350

Just look for system attributes that might be missing. I did a clean install on test system and replicated default attribute set.

  1. My default attribute set was one that didnt existing any more [this happened during migration from M1] - all I did was change it back to the real default in eav_entity_type table for entity type = catalog_product

Dont forget to clear browser cache and magento cache. For good measure, re compile and generate static files as well.

Hi, thank you for your report. It is a duplicate of 7579 and 5999. The problem is with incorrect attributes and attributes groups structure inside attribute set. The most common issue is with price attribute out of Product Details group and described in this comment. Try this solution

@olysenko have same problem. Price and price type attributes are located in product details group but it doesn't helps

I managed to fix my case by going through manually and checking each attribute - it turns out the "Design..." fields (which I've never used) were missing from the imported ones which stopped it working. Be nice that instead of "silently erroring", Magento just added the missing required attributes.

I had this issue too and nothing I tried could fix the migrated attribute sets. They have the design fields, they have price in the product details.
Eventually I created a new identical attribute set in Magento 2 and that one works. So my workaround became to just use this new attribute set for any new products.
As you mentioned existing products using the migrated attribute set seem to function properly, so at least I don't have to change all those over.

Actually, we've updated to 2.1.5 and freshly migrated data from the 2.1.5 data migration tool and the problem is gone. Perhaps it was a problem with the way the data migration tool pulled in attribute sets but now it's fixed.

Moving price attribute to Product Details Tab resolved this issue for me.

This issue was a bit brain-teaser. We had found a temporary workaround - Duplicate the product & make the changes and this issue does not happen.

@rbairwell, thank you for your report.
The issue is already fixed in develop branch
But we will consider to backport the fix to patch releases

I have create attribute set going through this tutorial https://magenticians.com/create-attribute-set-programmatically-magento-2/ . It helps me a lot to implement the code as i have not implemented the same for the first time but at last i fixed the error that i am having module not found.

Hi @engcom-backlog-nazar. Thank you for working on this issue.
Looks like this issue is already verified and confirmed. But if your want to validate it one more time, please, go though the following instruction:

  • [ ] 1. Add/Edit Component: XXXXX label(s) to the ticket, indicating the components it may be related to.
  • [ ] 2. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento-engcom-team give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!

  • [ ] 3. Verify that the issue is reproducible on 2.2-develop branch.

    Details- Add the comment @magento-engcom-team give me 2.2-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x

  • [ ] 4. If the issue is not relevant or is not reproducible any more, feel free to close it.

Hi @rbairwell The issue was re-tested and we can confirm that it was fixed on the 2.3 release branch. We closing this issue as fixed due to upcoming 2.3 release that will be available soon.

Hi all,
I have the same issue as Topic Started wrote (exactly the same)
We have a Migration_Default Attribute set.
Solution for me (may be project specified solution but maybe useful for someone else):
In Admin Panel relocate attribute quantity_and_stock status to Migration Prices attribute group (group with code advanced-pricing):
https://monosnap.com/file/0H3dl34HyBXlI2tDqtvBtg6NlLIRuI
https://monosnap.com/file/M9Iv1g7neSKqMdRZAbl3SGNpLSEA9S

Hi, thank you for your report. It is a duplicate of 7579 and 5999. The problem is with incorrect attributes and attributes groups structure inside attribute set. The most common issue is with price attribute out of Product Details group and described in this comment. Try this solution

Thanks saved my life :)

@olysenko have same problem. Price and price type attributes are located in product details group but it doesn't helps

@Koc May i know how did you solve this issue?

Hi, thank you for your report. It is a duplicate of 7579 and 5999. The problem is with incorrect attributes and attributes groups structure inside attribute set. The most common issue is with price attribute out of Product Details group and described in this comment. Try this solution

Thanks saved my life :)

@sskharate May i know how did you solve this issue?

Was this page helpful?
0 / 5 - 0 ratings