Question

I updated to Magento 2.2.6 via composer this morning however when running bin/magento setup:upgrade I get the following error:

Attribute with ID "Manufacturer" does not exist

This shows after the Upgrading data part for Magento_ConfigurableProduct within the setup upgrade command. Am wondering how to fix this and or if anyone else is experiencing it?

This seems to be caused by below code within UpgradeData.php for the Configurable Product module:

    if (version_compare($context->getVersion(), '2.2.1') < 0) {
        $relatedProductTypes = $this->getRelatedProductTypes('manufacturer', $eavSetup);
        if (!in_array(Configurable::TYPE_CODE, $relatedProductTypes)) {
            $relatedProductTypes[] = Configurable::TYPE_CODE;
            $this->updateRelatedProductTypes('manufacturer', $relatedProductTypes, $eavSetup);
        }
    }

I do not have a manufacturer attribute within this instance and I'm wondering if it has been deleted. Looking at other instances however this attribute is present but not a system attribute and can be deleted from admin so am wondering if this attribute is really needed and if not this should not really cause setup:upgrade to break?

Was it helpful?

Solution

I ran into this problem as well. Possibly due to a module we installed, the attribute was created and deleted. What ended up working to run the upgrade, was to create the attribute in the database. With the following queries.

INSERT INTO `eav_attribute` (`attribute_id`, `entity_type_id`, `attribute_code`, `attribute_model`, `backend_model`, `backend_type`, `backend_table`, `frontend_model`, `frontend_input`, `frontend_label`, `frontend_class`, `source_model`, `is_required`, `is_user_defined`, `default_value`, `is_unique`, `note`) VALUES (NULL, '4', 'manufacturer', NULL, NULL, 'varchar', NULL, NULL, 'text', 'Manufacturer', 'validate-length maximum-length-255', NULL, '0', '0', NULL, '0', NULL);

INSERT INTO catalog_eav_attribute (attribute_id, is_global, is_visible, is_searchable, is_filterable, is_comparable, is_visible_on_front, is_html_allowed_on_front, is_used_for_price_rules, is_filterable_in_search, used_in_product_listing, used_for_sort_by, apply_to, is_visible_in_advanced_search, position, is_wysiwyg_enabled, is_used_for_promo_rules, is_required_in_admin_store, is_used_in_grid, is_visible_in_grid, is_filterable_in_grid, search_weight, additional_data) VALUES (****eav_attribute attribute_id****, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, "simple, virtual, bundle, downloadable, configurable", 1, 0, 0, 0, 0, 0, 0, 0, 1, NULL);

With that I was able to compile the code. So far I have not come across any issues. But I'm not entirely sure if this is the correct answer to the issue. As I saw in a previous thread it is not a safe to create attributes manually in the database. But nothing ventured, nothing gained.

OTHER TIPS

We posted the same question on github for Magento 2. https://github.com/magento/magento2/issues/18134

I downgraded to 2.2.5 again using composer, used the database from the backup I created before, or just revert to the backup. Create the manufacturer attribute using the specs according to a original/clean 2.2.5 installation for that attribute. Again updated to 2.2.6, and it worked without the error.

All I've done to fix this is change manufacturer field type to select. (I deleted manufacutrer eav attribute and change unused field code to manufacturer)

After upgrade Magento 2.2.6, I also ran with the same problem. The Manufacturer attribute isn't showing in the admin.

I taken a look at answer of : Boris Thertus and ashrafnezhad here.

I found the attribute 'Manufacturer' is already available in database table 'eav_attribute' with 'attribute_id' = 81

Than I looked at another database table : catalog_eav_attribute with 'attribute_id' = 81

And in Column 'apply_to' updated the values with : 'simple, virtual, bundle, downloadable, configurable'

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top