Skip to content

Commit 292f928

Browse files
author
Stanislav Idolov
authored
ENGCOM-2793: [Forwardport] 6305 - Resolved product custom option title save issue #17607
2 parents 3586810 + 3ec14e7 commit 292f928

File tree

6 files changed

+11
-7
lines changed

6 files changed

+11
-7
lines changed

app/code/Magento/Catalog/Model/Product/Option/Validator/DefaultValidator.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,9 @@ protected function isValidOptionTitle($title, $storeId)
106106
if ($storeId > \Magento\Store\Model\Store::DEFAULT_STORE_ID && $title === null) {
107107
return true;
108108
}
109-
if ($this->isEmpty($title)) {
109+
110+
// checking whether title is null and is empty string
111+
if ($title === null || $title === '') {
110112
return false;
111113
}
112114

app/code/Magento/Catalog/Model/ResourceModel/Product/Option/Value.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,8 @@ protected function _saveValueTitles(AbstractModel $object)
256256
$object->unsetData('title');
257257
}
258258

259-
if ($object->getTitle()) {
259+
/*** Checking whether title is not null ***/
260+
if ($object->getTitle()!= null) {
260261
if ($existInCurrentStore) {
261262
if ($storeId == $object->getStoreId()) {
262263
$where = [

app/code/Magento/Sales/Model/Order/Pdf/Items/Invoice/DefaultInvoice.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,8 @@ public function draw()
127127
'feed' => 35,
128128
];
129129

130-
if ($option['value']) {
130+
// Checking whether option value is not null
131+
if ($option['value']!= null) {
131132
if (isset($option['print_value'])) {
132133
$printValue = $option['print_value'];
133134
} else {

app/code/Magento/Sales/Model/Order/Pdf/Items/Shipment/DefaultShipment.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public function draw()
8989
];
9090

9191
// draw options value
92-
if ($option['value']) {
92+
if ($option['value']!= null) {
9393
$printValue = isset(
9494
$option['print_value']
9595
) ? $option['print_value'] : $this->filterManager->stripTags(

dev/tests/api-functional/testsuite/Magento/Catalog/Api/ProductCustomOptionRepositoryTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ public function testAddNegative($optionData)
208208
];
209209

210210
if (TESTS_WEB_API_ADAPTER == self::ADAPTER_SOAP) {
211-
if (isset($optionDataPost['title']) && empty($optionDataPost['title'])) {
211+
if ($optionDataPost['title'] === null || $optionDataPost['title'] === '') {
212212
$this->expectException('SoapFault');
213213
$this->expectExceptionMessage('Missed values for option required fields');
214214
} else {

dev/tests/api-functional/testsuite/Magento/Catalog/Api/_files/product_options_negative.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
return [
88
'empty_required_field' => [
9-
'title' => '',
9+
'title' => null,
1010
'type' => 'field',
1111
'sort_order' => 1,
1212
'is_require' => 1,
@@ -54,7 +54,7 @@
5454
'price' => 10.0,
5555
'price_type' => 'fixed',
5656
'sku' => 'radio option 1 sku',
57-
'title' => '',
57+
'title' => null,
5858
'sort_order' => 1,
5959
],
6060
],

0 commit comments

Comments
 (0)