4

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?

  • did you do this BEFORE the upgrade to 2.2.6? What do you mean with "select", the entry "Multiple Select" ? – Hubertus Oct 28 '18 at 12:53
5

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.

  • I still have the attribute but after the update, it disappeared from the backend in the product view. This is statet in the github issue. Any fixes are welcome. – Johnny Longneck Sep 22 '18 at 21:40
3

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.

0

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)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.