EmicoEcommerce / Magento2TweakwiseExport-archived

Magento 2 module for Tweakwise export
Other
6 stars 16 forks source link

When having bundles with a lot of products the Products Iterator fails #63

Closed jasperzeinstra closed 5 years ago

jasperzeinstra commented 5 years ago

Issue Brief

We've got bundle products with 300 simple inside of them. The method \Emico\TweakwiseExport\Model\Write\Products\Iterator::getIterator uses a batch functionality. But this results in not being able to find the parent product.

[Emico\TweakwiseExport\Exception\InvalidArgumentException] Could not find export entity with id 5264

I think it's trying to get the parent of this simple product and that product is not inside this batch.

Environment

Steps to reproduce

  1. Install Magento from develop branch.
  2. Have some bundles with a lot of products
  3. Try to run the export command

Actual result

  1. Parent products aren't included in the batch.

Expected result

List the expected results as a bullet list of expectations

Work around for now is to comment this part of the code:

if ($batch->count() === self::BATCH_SIZE) {
    // After PHP7+ we can use yield from
    foreach ($this->processBatch($batch) as $processedEntity) {
        yield $processedEntity;
    }
    $batch = $this->collectionFactory->create(['storeId' => $this->storeId]);
}
edwinljacobs commented 5 years ago

Hi

Could it be that #62 also fixes this issue or are they completely unrelated?

With kind regards

jasperzeinstra commented 5 years ago

@edwinljacobs no, they are unrelated. My advice to test this is to set self::BATCH_SIZE to 2 or something and then see if you can run an export with demo products of Magento. I'm expecting that you can then reproduce the issue that the parent of a product can't be found in the current collection.

edwinljacobs commented 5 years ago

Ok will do, thanks for the information

edwinljacobs commented 5 years ago

Hi I am unable to reproduce this issue. I am currently on a 2.2.5 CE installation with demo products and altered self::BATCH_SIZE to 1. I also tried to adjust the EavIterator::ENTITY_BATCH_SIZE to 1 but that did not help. Are you sure that this is still an issue after fixing https://github.com/EmicoEcommerce/Magento2TweakwiseExport/issues/62?

That being said, we implement a more global batching process in the eav Iterator so there is no need to have another batch size constant in the product iterator. That one has been removed.

If this remains an issue can you tell me what I need to do to my database to make sure I can reproduce this?

With kind regards, Edwin

jasperzeinstra commented 5 years ago

@edwinljacobs I will try to reproduce this with a clean Magento installation with sample data and will come back to you.

edwinljacobs commented 5 years ago

Thanks :)

edwinljacobs commented 5 years ago

Is this still an issue?

edwinljacobs commented 5 years ago

For now I will close this issue. If this is incorrect you can make a new issue.

With kind regards, Edwin