magento2
magento2 copied to clipboard
Remove import column name character restrictions
Summary (*)
Model/Import/Entity/AbstractEntity restricts import column names to a-z (lowercase), 0-9 or underscore and must start with a-z (lowercase). Why? What is the point/value of this restriction?
Examples (*)
if (!$this->isAttributeParticular($columnName)) {
if (trim($columnName) == '') {
$emptyHeaderColumns[] = $columnNumber;
} elseif (!preg_match('/^[a-z][a-z0-9_]*$/', $columnName)) {
$invalidColumns[] = $columnName;
} elseif ($this->needColumnCheck && !in_array($columnName, $this->getValidColumnNames())) {
$invalidAttributes[] = $columnName;
}
}
Proposed solution
Either:
- Remove it.
- Make this more flexible so we can use a-z, A-Z, 0-9, spaces and whatever symbols we want.
- Add getValidatorPrereg() that allows us to override with our own checks for custom imports.
Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.
- [ ] Severity: S0 - Affects critical data or functionality and leaves users with no workaround.
- [ ] Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
- [ x] Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
- [ ] Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
- [ ] Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
Hi @adamlavery. Thank you for your report. To speed up processing of this issue, make sure that you provided the following information:
- Summary of the issue
- Information on your environment
- Steps to reproduce
- Expected and actual results
Make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:
@magento give me 2.4-develop instance - upcoming 2.4.x release
For more details, review the Magento Contributor Assistant documentation.
Add a comment to assign the issue: @magento I am working on this
To learn more about issue processing workflow, refer to the Code Contributions.
- Join Magento Community Engineering Slack and ask your questions in #github channel.
:warning: According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.
:clock10: You can find the schedule on the Magento Community Calendar page.
:telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.
:pencil2: Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel
Hi @engcom-Hotel. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:
-
[ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
Details
If the issue has a valid description, the labelIssue: Format is validwill be added to the issue automatically. Please, edit issue description if needed, until labelIssue: Format is validappears. -
[ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add
Issue: Clear Descriptionlabel to the issue by yourself. -
[ ] 3. Add
Component: XXXXXlabel(s) to the ticket, indicating the components it may be related to. -
[ ] 4. Verify that the issue is reproducible on
2.4-developbranchDetails
- Add the comment@magento give me 2.4-develop instanceto deploy test instance on Magento infrastructure.
- If the issue is reproducible on2.4-developbranch, please, add the labelReproduced on 2.4.x.
- If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here! -
[ ] 5. Add label
Issue: Confirmedonce verification is complete. -
[ ] 6. Make sure that automatic system confirms that report has been added to the backlog.
Hello @adamlavery,
Thanks for the report and collaboration!
To more understand the issue we need your use case in which this functionality is not working for you as expected and also please provide the below information as well:
- Information on your environment
- Steps to reproduce
- Expected and actual results (with screenshot if possible)
Thanks
Hi, the issue is described well enough already and doesn't need screenshots or steps. Below example of a custom import that is blocked by the a-z/0-9 column name restriction. Had to override the core class to allow this format to be read so it can be processed.
QTYID/QTY,"272*100% Recycled/515*Large Square Box/2703","272*100% Recycled/516*Medium Square Box/2702","272*100% Recycled/517*Small Square Box/2701","272*100% Recycled/457*Soap Standard Box /2700","246*Unprinted Kraft Board/515*Large Square Box/2707","246*Unprinted Kraft Board/516*Medium Square Box/2706","246*Unprinted Kraft Board/517*Small Square Box/2705","246*Unprinted Kraft Board/457*Soap Standard Box /2704"
3022/50,70.00,68.00,66.00,67.00,84.00,82.00,79.00,81.00
3023/100,74.00,72.00,70.00,71.00,86.00,84.00,81.00,83.00
3024/200,82.00,80.00,77.00,79.00,88.00,86.00,83.00,85.00
3025/300,92.00,89.00,86.00,88.00,109.00,106.00,103.00,105.00
3026/400,101.00,98.00,95.00,97.00,111.00,108.00,105.00,107.00
3027/500,111.00,108.00,105.00,107.00,115.00,112.00,109.00,111.00
3028/600,121.00,117.00,114.00,116.00,136.00,132.00,128.00,131.00
3029/700,130.00,126.00,123.00,125.00,140.00,136.00,132.00,135.00
3030/800,138.00,134.00,130.00,133.00,142.00,138.00,134.00,137.00
3031/900,148.00,143.00,139.00,142.00,163.00,159.00,154.00,157.00
3032/1000,158.00,154.00,149.00,152.00,167.00,163.00,158.00,161.00
The sensible approach is to allow the child class to specify a different validation check, defaulting to usual core validation.
Hello @adamlavery,
We have tried to reproduce the issue in Magento 2.4-develop and the issue seems reproducible for us via following the below steps:
- Edit
app/code/Magento/Catalog/etc/db_schema.xmlline number 17 and add a new column with nameSku_1 - Run
bin/magento setup:upgrade. This will create a new column with nameSku_1in tablecatalog_product_entity. - Try to upload the CSV by adding newly created column in the CSV file from
admin->System->Data Transfer->Import - The script will fail for the newly created column

Hence confirming the issue.
Thanks
:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/AC-6030 is successfully created for this GitHub issue.
:white_check_mark: Confirmed by @engcom-Hotel. Thank you for verifying the issue.
Issue Available: @engcom-Hotel, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.
@magento I am working on this