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

Add frontend validation for SKU on configurable product variation gen… #3

Merged
merged 1 commit into from
Apr 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@
"100.2.*"
]
}
},
"magento/module-configurableproduct": {
"Add frontend validation for SKU on configurable product variation generation in admin panel": {
"source" : "patches/Magento_ConfigurableProduct/magento2-issue-11953.patch",
"version" : [
"100.2.*"
]
}
}
}
}
Expand Down
69 changes: 69 additions & 0 deletions patches/Magento_ConfigurableProduct/magento2-issue-11953.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
From 5cf0d3480fcc302f922fce12a588afd5e5771491 Mon Sep 17 00:00:00 2001
From: "a.muntian" <a.muntian@astoundcommerce.com>
Date: Fri, 15 Dec 2017 13:54:04 +0200
Subject: [PATCH 1/2] magento/magento2#11953: Product configuration creator
does not warn about invalid SKUs - Added validation for SKU field inside
"Configurations" tab

---
.../DataProvider/Product/Form/Modifier/ConfigurablePanel.php | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/Ui/DataProvider/Product/Form/Modifier/ConfigurablePanel.php b/Ui/DataProvider/Product/Form/Modifier/ConfigurablePanel.php
index 0e03dfe3cde5..f1d67eee8e6d 100644
--- a/Ui/DataProvider/Product/Form/Modifier/ConfigurablePanel.php
+++ b/Ui/DataProvider/Product/Form/Modifier/ConfigurablePanel.php
@@ -466,7 +466,17 @@ protected function getRows()
[],
['dataScope' => 'product_link']
),
- 'sku_container' => $this->getColumn('sku', __('SKU')),
+ 'sku_container' => $this->getColumn(
+ 'sku',
+ __('SKU'),
+ [
+ 'validation' =>
+ [
+ 'min_text_length' => '1',
+ 'max_text_length' => '10',
+ ]
+ ]
+ ),
'price_container' => $this->getColumn(
'price',
__('Price'),

From 7418f1ac607c68003c2f4122f2b1bf07a35c044e Mon Sep 17 00:00:00 2001
From: zamoroka <zapashok0@gmail.com>
Date: Fri, 15 Dec 2017 14:19:27 +0200
Subject: [PATCH 2/2] magento/magento2#11953: Product configuration creator
does not warn about invalid SKUs - Make sku field as required - Length of
sku gets from Sku model

---
.../Ui/DataProvider/Product/Form/Modifier/ConfigurablePanel.php | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/Ui/DataProvider/Product/Form/Modifier/ConfigurablePanel.php b/Ui/DataProvider/Product/Form/Modifier/ConfigurablePanel.php
index f1d67eee8e6d..9fd225e8acaa 100644
--- a/Ui/DataProvider/Product/Form/Modifier/ConfigurablePanel.php
+++ b/Ui/DataProvider/Product/Form/Modifier/ConfigurablePanel.php
@@ -5,6 +5,7 @@
*/
namespace Magento\ConfigurableProduct\Ui\DataProvider\Product\Form\Modifier;

+use Magento\Catalog\Model\Product\Attribute\Backend\Sku;
use Magento\Catalog\Ui\DataProvider\Product\Form\Modifier\AbstractModifier;
use Magento\Ui\Component\Container;
use Magento\Ui\Component\Form;
@@ -472,8 +473,8 @@ protected function getRows()
[
'validation' =>
[
- 'min_text_length' => '1',
- 'max_text_length' => '10',
+ 'required-entry' => true,
+ 'max_text_length' => Sku::SKU_MAX_LENGTH,
]
]
),