magento-engcom / import-export-improvements

Open Software License 3.0
31 stars 29 forks source link

Improve Errormessage #82

Closed piotrekkaminski closed 6 years ago

piotrekkaminski commented 6 years ago

From @brosenberger on October 30, 2017 10:53

Preconditions

  1. Misconfigured product update within UpgradeData-Script:
    $eavSetup->addAttribute(\Magento\Catalog\Model\Product::ENTITY, 'pim_option_1', [
    ...
    'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_WEBSITE,
    ...
    ]);

Steps to reproduce

  1. Create a correct product import csv for a configurable product including some references within the configuration_variants column
  2. go to admin-backend/system/import
  3. choose products to import with above created import file
  4. press validate data button

Expected result

  1. validation erros shows up with a more specific message like 'Attribute with code must be global and is not super in row(s)'
  2. see https://magento.stackexchange.com/questions/139630/attribute-with-this-code-is-not-super-in-row-magento-2

    Actual result

  3. validation error shows up with message: Attribute with this code is not super in row(s)

Copied from original issue: magento/magento2#11871

piotrekkaminski commented 6 years ago

From @orlangur on October 30, 2017 12:6

must be global and is not super in row(s)

Such message has no sense as every global select is considered to be super by design:

// save super attributes for simplier and quicker search in future
        if ('select' == $attrParams['type'] && 1 == $attrParams['is_global']) {
            $this->_superAttributes[$attrParams['code']] = $attrParams;
        }

However, check for is_global could be implemented as separate with separate error message.

piotrekkaminski commented 6 years ago

From @magento-engcom-team on November 17, 2017 10:30

@brosenberger, thank you for your report. We've created internal ticket(s) MAGETWO-84059 to track progress on the issue.

tadhgbowe commented 6 years ago

@piotrekkaminski - I've reviewed this.

TESTED ON [Magento Commerce 2.2.2] and [2.3-develop]

If the import detects that a configurable_variations attribute code is not super the following checks are needed:

  1. Check attribute exists.
  2. Check that it has a Catalog Input Type of "Dropdown", "Visual Swatch" or Text Swatch"
  3. Check that it has a Scope of "Global".
  4. Check that it exists in required Attribute Set.

At the moment we only have a check to see if the attribute is in the list of super attributes:

if (!$this->_isAttributeSuper($superAttrCode)) { FAIL - DISPLAY ERROR }

Is the intended result:

  1. to try pinpoint exactly which one(s) of the above the attribute has failed on? That will require extra coding. I'm not sure all the information is available at that moment in time.

  2. to simply expand the message to alert the user of all possible reasons why.

Thanks, Tadhg

piotrekkaminski commented 6 years ago

I'd prefer detailed message when available, when not a list of possible reasons. The easier we can make it for people to avoid looking at CSV trying to guess what's wrong, the better.

tadhgbowe commented 6 years ago

@piotrekkaminski - Agreed. It's on my radar. Thanks. T

tadhgbowe commented 6 years ago

Quick update from me:

If the import detects that a configurable_variations attribute code is not super one the following error messages will be displayed:

Attribute code does not exist or is not in chosen attribute set. Attribute code needs to have an Input Type of "Dropdown", "Visual Swatch" or Text Swatch" Attribute code needs to have a Scope of "Global".

This covers all reasons why is not super. I will submit a pull request early next week for this.

Thanks. T.

dmanners commented 6 years ago

Thank you @tadhgbowe for your fix for this issue. PR https://github.com/magento-engcom/import-export-improvements/pull/115 has added more detailed information to error messages here.