Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolved undefined index issue for import adapter #19765

Merged
merged 2 commits into from
Apr 5, 2019

Conversation

jaimin-ktpl
Copy link
Contributor

@jaimin-ktpl jaimin-ktpl commented Dec 14, 2018

Description (*)

Added a condition to check if 'sku' column exists in CSV file before setting its value.

Fixed Issues (if relevant)

  1. Custom import adapter data validation issue #19761: Custom import adapter data validation issue

Manual testing scenarios (*)

  1. Create a custom import adapter extending Magento\ImportExport\Model\Import\Entity\AbstractEntity
  2. Add valid columns in getValidColumnNames() function.
    e.g. ['column1', 'column2', 'column3']
  3. Create CSV file with columns stated above and add data.
  4. Go to System > Import
  5. Select your adapter from "Entity Type" dropdown
  6. Select your CSV file in "Select File to Import" field.
  7. Click on "Check Data" button
  8. CSV file should get validated if column and data are available

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

@magento-engcom-team
Copy link
Contributor

Hi @jaimin-ktpl. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento-engcom-team give me test instance - deploy test instance based on PR changes
  • @magento-engcom-team give me 2.3-develop instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Assistant documentation

@sivaschenko
Copy link
Member

Hi @jaimin-ktpl thanks for your contribution! As I can see the $skuSet variable is used to count number of processed entities. So in case, when there is no sku, this calculation will not work. Is there a way to replace the hardcoded sku field to a dynamic record identifier?

@jaimin-ktpl
Copy link
Contributor Author

jaimin-ktpl commented Dec 14, 2018

Hello @sivaschenko , Thank you for your inputs on it. Can we set an incremental variable for each valid row? Something like, $entitySet instead of $skuSet.
Or we can directly increase value of $_processedEntitiesCount for each valid rows?

@sivaschenko
Copy link
Member

Hi @jaimin-ktpl , I think there may be no need for a variable and we may directly increment the $_processedEntitiesCount for each valid row.

I.e. that's exactly how _processedEntitiesCount handled in

and

However, there is a concern about the reason the code was using the sku key at the first place. I think that's used to handle a case when import contains multiple rows for a single enitity. To count entities instead of just rows.

@jaimin-ktpl
Copy link
Contributor Author

Hello @sivaschenko , I have updated the code to check for entity count.

@magento-engcom-team magento-engcom-team added this to the Release: 2.3.1 milestone Dec 27, 2018
@okorshenko okorshenko removed this from the Release: 2.3.1 milestone Jan 28, 2019
@jaimin-ktpl
Copy link
Contributor Author

@VladimirZaets , waiting for your review on this PR. Please review it when you have time.. Thanks.

@VladimirZaets
Copy link
Contributor

Hi, @jaimin-ktpl. The ticked already reviewed and currently in processing status. Thanks

@p-bystritsky
Copy link
Contributor

QA passed.

@m2-assistant
Copy link

m2-assistant bot commented Apr 5, 2019

Hi @jaimin-ktpl, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants