Magento2: [EE 2.1.0] - Edit Product doesn't work after upgrade from 2.0.7 to 2.1.0

Created on 29 Jun 2016  路  30Comments  路  Source: magento/magento2

Steps to reproduce

  1. Upgrade Magento EE from 2.0.7 to 2.1.0
  2. Log in to backend and browse to products -> catalog
  3. Click on any product to edit

    Expected result

  4. Product can be edited

    Actual result

  5. HTTP ERROR 500

error log:
`PHP message: PHP Fatal error: Uncaught TypeError: Argument 3 passed to Magento\Framework\View\Element\UiComponentFactory::mergeMetadataElement() must be of the type array, null given, called in /var/www/html/vendor/magento/framework/View/Element/UiComponentFactory.php on line 335 and defined in /var/www/html/vendor/magento/framework/View/Element/UiComponentFactory.php:287
Stack trace:

0 /var/www/html/vendor/magento/framework/View/Element/UiComponentFactory.php(335): Magento\Framework\View\Element\UiComponentFactory->mergeMetadataElement(Array, 'schedule-design...', NULL, false)

1 /var/www/html/vendor/magento/framework/View/Element/UiComponentFactory.php(363): Magento\Framework\View\Element\UiComponentFactory->mergeMetadataItem(Array, Array, false)

2 /var/www/html/vendor/magento/framework/View/Element/UiComponentFactory.php(363): Magento\Framework\View\Element\UiComponentFactory->mergeMetadataItem(Array, Array, false)`

magento_debug

Workaround:
If you disable following modules it will work properly:
Magento_BundleStaging Magento_ConfigurableProductStaging Magento_CatalogImportExportStaging Magento_CatalogStaging Magento_DownloadableStaging Magento_ProductVideoStaging

Catalog Ready for Work bug report

Most helpful comment

Firstly, the issue should happen for the products using custom attribute sets. You just need to go to the database to fix the schedule design update attribute group in the custom attribute sets and then you should be able to access the product edit page. After that, you may be not able to save because of another issue - "Update with id "0" does not exist.". For this following issue, you can solve it by update the value of the column "created_in" in the table "catalog_product_entity" from 0 to 1.

I spent whole day to solve it.

All 30 comments

Same problem here. Also with Magento 2.1.0 EE upgraded from 2.0.7

Same - Upgraded Magento 2.0 to 2.1.

We are facing the similar issue

Same problem here

After disabling this module we have facing another issue
Warning: Illegal string offset 'is_in_stock' in /vagrant/vendor/magento/module-catalog-inventory/Ui/DataProvider/Product/Form/Modifier/AdvancedInventory.php on line 87

Same problem here.

I've done a hack into that foreach:

if (
    is_string($name) &&
    strcasecmp($name, "schedule-design-update") === 0 &&
    is_null($data)) {
    continue;
} 

The page renders but I can't save the product. I get this error:
Update with id "0" does not exist.
Message is from Magento\Staging\Model\UpdateRepository::get() function.
Also noticed in staging_update table that I had in id column a timestamp value 1467394728 which is actually what is in start_time also. I've created a campaign to test previously. But the start and end time had bugs, had to place only start_time.

On a default Magento EE 2.1 installation I don't get this error but I do get it in a store installation.
Anyway start_time and end_time of schedule update don't seem to work in admin forms (both installs). I don't know now if it's related to current issue.

Anyone has a solution for this ?

Thank you

Firstly, the issue should happen for the products using custom attribute sets. You just need to go to the database to fix the schedule design update attribute group in the custom attribute sets and then you should be able to access the product edit page. After that, you may be not able to save because of another issue - "Update with id "0" does not exist.". For this following issue, you can solve it by update the value of the column "created_in" in the table "catalog_product_entity" from 0 to 1.

I spent whole day to solve it.

@jasonyip2014 This works. I did as you said:
1)
UPDATE eav_attribute_group SET tab_group_code = "advanced", sort_order = 55 WHERE attribute_group_code = "schedule-design-update";
`// This will update default attribute set too but it should have these values already.

2) And moved in admin 3 attributes in each custom attribute set:

  • custom_design_from
  • custom_design_to
  • custom_design
  • custom_layout (already there)
    in group Schedule Design Update.
    Now I can see the product page in admin.

3)
UPDATE catalog_product_entity SET created_in = "1";

Just in case, flushed cache storage, cleared var/generation/* and deployed static content in pub/static (not the magento command).
And reindex everything with command magento indexer:reindex

Thank you

Updating the value suggested by @jasonyip2014 corrects my product editing issue as well, but I'm still trying to understand why this is necessary. The InstallData.php script for the catalog-staging module explicitly sets the created_in value of all existing products to 0. As we've seen this destroys the ability to update products that existed prior to the 2.1 update, but is there a reason why this value was used? What does the created_in value actually mean in this context?

Thank you for response, internal ticket MAGETWO-55944 was created.

Hi there.
Well, my Magento has been updated automatically from 2.0.7 to 2.1 by my host provider. Before 2.1 there was all OK. After the update, I can't see the Catalog products (that nasty "processing" round sign runs endless) and the Category page loads, but freezes before I can click on any link (again that endless rolling sign). The "customers" page doesn't load as well and neither the whole section "Sales".

I checked al the comments above, but in my MySQL database everything looks OK. Except there's NO "created_in" column in my "catalog_product_entity" ???

Front-end (with Porto theme) looks OK and shows all the products.

Any suggestion?
Thank you very much,
Tom

@ttoman69 This issue is regarding Enterprise Edition and EE-specific features. You should not expect to have a 'created_in' column, and any issues you are experiencing are unrelated. It sounds like all of your UI components are malfunctioning -- I would redeploy static content, and if that doesn't fix it, check every third-party extension.

@rhoerr Thank you for the answer. Yeah, I see now it's for EE, sorry :( Errr... Well... I'd like to ask you another question, but I'm going to do it like REALLY quietly, because it could be one of those dumb ones _blush_: What did you mean with "redeploy static content"? However I did switch the default plugin for currency conversion with some other which converts the currencies from Yahoo....

Have a great day and thank you again for your answer.
Tom

@ttoman69: SSH or command line from site root: php bin/magento setup:static-content:deploy -- see http://devdocs.magento.com/guides/v2.1/config-guide/cli/config-cli-subcommands-static-view.html

@rhoerr Thank you very much. I did it, but still a blank page :(

Have a great day :)

@rhoerr I'll slap my face with a digital log. I swear!
I cleared the cache in my Firefox. Now it works like a charm. _double blush_

Have a great day folk.

I had the same issue on Magento 2.1 CE updated from 2.0.7,
the solution is to have "Product Details" group in attribute set - I had "General" group with name, sku, etc attributes. Renaming of "General" to "Product Details", reindex and cache flush fixed this.

For me following point 2 in the above message by @daniel-ifrim solved the problem. All the attribute sets must have those attributes in that group, this seems related to the scheduled updates feature.

Nonetheless it is quite disappointing to see a major bug like this in EE not fixed in two months.

We have the same issue as well, upgrading from 2.0.2 to 2.1.0. Followed @jasonyip2014 's instructions but we didn't have any custom attribute sets so all attributes were already in place. Ran the SQL commands but still no luck. Any more ideas?

I too have changed created_in from 0 to 1.

Further to @moloughlin comment, I tried to follow created_in through Magento\Staging\Model\VersionManager.

I wonder if the InstallData.php of Magento\CatalogStaging\Setup should in fact set created_in to be the class constant Magento\Staging\Model\VersionManager::MIN_VERSION noting const MIN_VERSION = 1; and not 0.

I am confused because I expect to find a table somewhere tracking version numbers and in particular version number id and I think that table is staging_update but I see it as an empty table. I think that leaves the fall back as VersionManager::MIN_VERSION due to this code:

\\ \Magento\Staging\Model\Operation\Update\RescheduleUpdate
function getPrevious(EntityMetadataInterface $metadata, $version, $identifier)
{
    \\...
    return $previous ?: VersionManager::MIN_VERSION;
}

Which will return 1 and not zero.

So maybe the answer is to change const MIN_VERSION = 1; to be const MIN_VERSION = 0; and leave column created_in values at '0' but I didn't try that.

I scripted @jasonyip2014's answer to:

<?php

namespace Example\Module\Setup;

use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Framework\Setup\UpgradeDataInterface;

/**
 * Class UpgradeData
 * @package Example\Module\Setup
 */
class UpgradeData implements UpgradeDataInterface
{
    /**
     * @var \Magento\Eav\Setup\EavSetupFactory
     */
    protected $eavSetupFactory;

    /**
     * UpgradeData constructor.
     * @param \Magento\Eav\Setup\EavSetupFactory $eavSetupFactory
     */
    public function __construct(
        \Magento\Eav\Setup\EavSetupFactory $eavSetupFactory
    ) {
        $this->eavSetupFactory = $eavSetupFactory;
    }

    /**
     * @param ModuleDataSetupInterface $setup
     * @param ModuleContextInterface $context
     */
    public function upgrade(
        ModuleDataSetupInterface $setup,
        ModuleContextInterface $context
    ) {
        $setup->startSetup();

        if (version_compare($context->getVersion(), '1.0.0', '<')) {
            /** @var \Magento\Eav\Setup\EavSetup $eavSetup */
            $eavSetup = $this->eavSetupFactory->create();

            $setup->getConnection()->update(
                'eav_attribute_group',
                ['tab_group_code' => 'advanced', 'sort_order' => 55],
                'attribute_group_code = "schedule-design-update"'
            );

            $setIds = $eavSetup->getAllAttributeSetIds(\Magento\Catalog\Model\Product::ENTITY);
            $groupId = 'schedule-design-update';
            foreach ($setIds as $setId) {
                foreach (['custom_design_from', 'custom_design_to', 'custom_design', 'custom_layout'] as $attribute) {
                    $eavSetup->addAttributeToSet(\Magento\Catalog\Model\Product::ENTITY, $setId, $groupId, $attribute);
                }
            }

            $setup->getConnection()->update('catalog_product_entity', ['created_in' => 1]);
        }

        $setup->endSetup();
    }
}

Just upgraded today and this is still an issue. The above script does seem to fix the problem. Is that going to be the official fix?

https://jira.corp.magento.com/browse/MAGETWO-55944 ticket closed as cannot reproduce so closing

Instead of asking for more information about how to reproduce the issue, you close it? Wow.

Hi All,
Those who are facing this error should check there attributes set in admin, for me the whole attribute set was empty (default + migration_default). Assign the attributes to the set, reindex the data and check the product

Also check if the attribute set id is set for that product or not in admin ( table catalog_product_entity)

Yes @vkhandelwal1993 is right. I migrated the data from magento 1.9.3.7 to magento 2.2.5. When I click the add product button it showed me the same error. The way I resolved it was to go Admin->Store->Attribute Set. And edited the Default and Migration_Default Attributes Set. Initially the Migration_Default Attribute had the attribute sets but the Default was empty. I added the attributes to the Default Attribute Set and executed the reindex command
sudo php bin/magento indexer:reindex

And it worked...

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

@jasonyip2014 This works. I did as you said:
1)
UPDATE eav_attribute_group SET tab_group_code = "advanced", sort_order = 55 WHERE attribute_group_code = "schedule-design-update";
`// This will update default attribute set too but it should have these values already.

  1. And moved in admin 3 attributes in each custom attribute set:
  • custom_design_from
  • custom_design_to
  • custom_design
  • custom_layout (already there)
    in group Schedule Design Update.
    Now I can see the product page in admin.

UPDATE catalog_product_entity SET created_in = "1";

Just in case, flushed cache storage, cleared var/generation/* and deployed static content in pub/static (not the magento command).
And reindex everything with command magento indexer:reindex

Thank you

1) Run the command : UPDATE eav_attribute_group SET tab_group_code = "advanced", sort_order = 55 WHERE attribute_group_code = "schedule-design-update"; 2) Default Attribute set : https://snipboard.io/T1M6h0.jpg & Migration_Default Attribute set : https://snipboard.io/tHuUnF.jpg 3) Run the command UPDATE catalog_product_entity SET created_in = "1"; Finally flush cache, compile, reindexed Still getting same error.

Did anyone found the solution?

Was this page helpful?
0 / 5 - 0 ratings