Skip to content

Trim SKU before product save#14245

Closed
birmo wants to merge 2 commits intomagento:2.2-developfrom
birmo:bug/trim-product-data-value
Closed

Trim SKU before product save#14245
birmo wants to merge 2 commits intomagento:2.2-developfrom
birmo:bug/trim-product-data-value

Conversation

@birmo
Copy link
Copy Markdown

@birmo birmo commented Mar 22, 2018

Description

There is a problem with spaces before and after attributes value. The problem is very annoying at SKU. It leads to many misunderstandings because for example 'my-sku' is different than 'my-sku ' (look at the space).
I fixed it adding trim function to every product data value.

Manual testing scenarios

  1. Set the SKU with space before or after the right value in admin.
  2. Save product.
  3. Space on the beginning and on the end of SKU value should disappear.

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-cicd2
Copy link
Copy Markdown
Contributor

CLA assistant check
Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.

@ihor-sviziev
Copy link
Copy Markdown
Contributor

@dmanners AFAIK you already discussed this issue as part of import export improvements project. Could you please review this PR?

@ihor-sviziev ihor-sviziev requested a review from dmanners March 22, 2018 12:33
* @param array $productData
* @return array
*/
protected function trimData(array $productData)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a copy of normalize method which is going to be removed: https://github.com/birmo/magento2/blob/2.2-develop/app/code/Magento/Catalog/Controller/Adminhtml/Product/Initialization/Helper.php#L303

Need to be found out in favor of what normalize is going to be removed.

@dmanners
Copy link
Copy Markdown
Contributor

Thanks for letting me know @ihor-sviziev .

And thank you for this pull request @birmo currently we already have a pull request in place for this as part of the import/export project. As such I will close this pull request as a duplicate.

magento-engcom/import-export-improvements#102

@dmanners dmanners closed this Mar 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants