3

I have imported my cats and products from Magento 1 into Magento 2. The categories show in the front end but it states that no products can be found. In the admin, the cats show, with their products.

However, on adding a new sub cat, the record appears to save but gets added onto the tree with an empty name. Loading it shows all data is blank. Trying to edit an existing (imported category) also results in the data to become blank. I noticed in the catalog_category_entity table that all the imported cats (which are showing on the front end, albeit without products showing) have an attribute_set_id of 3 but the new ones I am trying to create, or edit, end up with an attribute_set_id of 20.

---- update ---

I have taken a look at the eav_attribute_set table and can see why there is a problem. I just don't know what to do about it yet. All object types have two references, the one from the migration and default. Here are the entries for type 3 (Categories).

attribute_set_id   |   entity_type_id   | attribute_set_name 
... 
        3          |           3        |  Migration_Default
...
        20         |           3        |  Default

Any ideas on how to sort this pickle?

1
  • I have tried to set the default_attribute_set_id in eav_entity_types but it still (oddly) create a new on as set_id 20 and no data saves - an empty record is created. Commented Sep 4, 2019 at 10:12

3 Answers 3

2

In the end I

  1. removed the "Default" attribute sets from eav_attribute_set,
  2. set all categories to attribute_set_id 3 in catalog_category_entity and
  3. set the default category attribute to set to be 3 in eav_entity_type where it was set to 20 (and also the default attribute set for products to make sure they were added like the imported ones).

This corrected the problems with adding new categories in the admin and showed the products in the front end categories.

I had to fully clear all the caches and reindex for this to work.

0

Some of your images have errors so the resize images process does not complete.

You should access to the file: vendor/magento/module-media-storage/Service/ImageResize.php, then find function: resizeFromThemes. Next, run this command:

$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$logger = $objectManager->create("\Psr\Log\LoggerInterface");
foreach ($productImages as $image) {
try {
    $error = '';
    $originalImageName = $image['filepath'];

    $mediastoragefilename = $this->imageConfig->getMediaPath($originalImageName);
    $originalImagePath = $this->mediaDirectory->getAbsolutePath($mediastoragefilename);

    if ($this->mediaDirectory->isFile($originalImagePath)) {
        foreach ($viewImages as $viewImage) {
            if ($this->fileStorageDatabase->checkDbUsage()) {
                $this->fileStorageDatabase->saveFileToFilesystem($mediastoragefilename);
            }
            $this->resize($viewImage, $originalImagePath, $originalImageName);
        }
    } else {
        $error = __('Cannot resize image "%1" - original image not found', $originalImagePath);
    }
    yield ['filename' => $originalImageName, 'error' => $error] => $count;
} catch (\Exception $e) {
    $logger->notice($image['filepath'] . " - " . $e->getMessage());
        continue;
    }
}

After that, access to the file var/log/debug.log, you will see all the error image files are logged.

Please let me know if it works!

0

Well so the problem is in your database M1 eav_attribute_set, the attribute_set_name is Default for much group and on migration magento create new one with new id for attribute_set_id and update the eav_entity_attribute table on that id for category attribute so the relation between entity and attribute is broken that's why magento 2 can t find attribute of category on category admin edit page.

So you can go in magento 2 database after migration on eav_entity_attribute table and change all the attribute_set_id of your category entity for the good old id and it works ! you can find the good attribute_set_id on the table catalog_category_entity 'attribute_set_id' of your old category. Normaly the first attribute id of category in table eav_entity_attribute is the id 45 of attribute "name".

in additionnal way https://github.com/magento/magento2/issues/5873

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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