Skip to content

Commit 66bb273

Browse files
🔃 [Magento Community Engineering] Community Contributions - 2.3-develop
Accepted Community Pull Requests: - #23360: #23354 : Data saving problem error showing when leave blank qty and update it (by @konarshankar07) - #23496: Resolved + character issue in custom widget (by @sarfarazbheda) - #23310: magento/magento-2#23222: setup:upgrade should return failure when app� (by @ProcessEight) - #23529: Feature/9798 updating configurable product options based on produc id and sku (by @lpouwelse) - #23427: 23424: fixed search with 0 (by @jeysmook) Fixed GitHub Issues: - #23354: Data saving problem error showing when leave blank qty and update it (reported by @bhavik43) has been fixed in #23360 by @konarshankar07 in 2.3-develop branch Related commits: 1. 471fd85 - #16234: Unable to enter `+` character in widget content (reported by @molovo) has been fixed in #23496 by @sarfarazbheda in 2.3-develop branch Related commits: 1. 538f690 2. bfa6074 - #23222: setup:upgrade should return failure when app:config:import failed (reported by @stkrelax) has been fixed in #23310 by @ProcessEight in 2.3-develop branch Related commits: 1. 8c4667a 2. 671876e - #9798: Problem adding attribute options to configurable product via REST Api (reported by @troublediehard) has been fixed in #23529 by @lpouwelse in 2.3-develop branch Related commits: 1. f6c957c 2. c0a360f - #23424: Search by keyword didn't work properly with "0" value (reported by @engcom-Golf) has been fixed in #23427 by @jeysmook in 2.3-develop branch Related commits: 1. 36190fb 2. a8f5c0d 3. dfd664e
2 parents a72432e + 71fac5b commit 66bb273

File tree

7 files changed

+73
-12
lines changed

7 files changed

+73
-12
lines changed

app/code/Magento/CatalogSearch/Ui/DataProvider/Product/AddFulltextFilterToCollection.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
*/
66
namespace Magento\CatalogSearch\Ui\DataProvider\Product;
77

8-
use Magento\Framework\Data\Collection;
98
use Magento\CatalogSearch\Model\ResourceModel\Search\Collection as SearchCollection;
9+
use Magento\Framework\Data\Collection;
1010
use Magento\Ui\DataProvider\AddFilterToCollectionInterface;
1111

1212
/**
@@ -30,14 +30,14 @@ public function __construct(SearchCollection $searchCollection)
3030
}
3131

3232
/**
33-
* {@inheritdoc}
33+
* @inheritdoc
3434
*
3535
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
3636
*/
3737
public function addFilter(Collection $collection, $field, $condition = null)
3838
{
3939
/** @var $collection \Magento\Catalog\Model\ResourceModel\Product\Collection */
40-
if (isset($condition['fulltext']) && !empty($condition['fulltext'])) {
40+
if (isset($condition['fulltext']) && (string)$condition['fulltext'] !== '') {
4141
$this->searchCollection->addBackendSearchFilter($condition['fulltext']);
4242
$productIds = $this->searchCollection->load()->getAllIds();
4343
$collection->addIdFilter($productIds);

app/code/Magento/ConfigurableProduct/Model/OptionRepository.php

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
use Magento\Store\Model\Store;
2323

2424
/**
25+
* Repository for performing CRUD operations for a configurable product's options.
2526
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2627
*/
2728
class OptionRepository implements \Magento\ConfigurableProduct\Api\OptionRepositoryInterface
@@ -112,7 +113,7 @@ public function __construct(
112113
}
113114

114115
/**
115-
* {@inheritdoc}
116+
* @inheritdoc
116117
*/
117118
public function get($sku, $id)
118119
{
@@ -131,7 +132,7 @@ public function get($sku, $id)
131132
}
132133

133134
/**
134-
* {@inheritdoc}
135+
* @inheritdoc
135136
*/
136137
public function getList($sku)
137138
{
@@ -141,7 +142,7 @@ public function getList($sku)
141142
}
142143

143144
/**
144-
* {@inheritdoc}
145+
* @inheritdoc
145146
*/
146147
public function delete(OptionInterface $option)
147148
{
@@ -167,7 +168,7 @@ public function delete(OptionInterface $option)
167168
}
168169

169170
/**
170-
* {@inheritdoc}
171+
* @inheritdoc
171172
*/
172173
public function deleteById($sku, $id)
173174
{
@@ -184,7 +185,7 @@ public function deleteById($sku, $id)
184185
}
185186

186187
/**
187-
* {@inheritdoc}
188+
* @inheritdoc
188189
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
189190
*/
190191
public function save($sku, OptionInterface $option)
@@ -213,6 +214,16 @@ public function save($sku, OptionInterface $option)
213214
throw new \InvalidArgumentException('Incompatible product type');
214215
}
215216
$option->setProductId($product->getData($metadata->getLinkField()));
217+
if (!empty($option->getProductId() && !empty($option->getAttributeId()))) {
218+
$id = $this->optionResource->getIdByProductIdAndAttributeId(
219+
$option,
220+
$option->getProductId(),
221+
$option->getAttributeId()
222+
);
223+
if (!empty($id)) {
224+
$option->setId($id);
225+
}
226+
}
216227
}
217228

218229
try {
@@ -296,6 +307,7 @@ public function validateNewOptionData(OptionInterface $option)
296307

297308
/**
298309
* Get MetadataPool instance
310+
*
299311
* @return MetadataPool
300312
*/
301313
private function getMetadataPool()

app/code/Magento/Multishipping/view/frontend/templates/checkout/addresses.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
size="2"
6565
min="0"
6666
class="input-text qty"
67-
data-validate="{number: true,'validate-greater-than-zero':true}"/>
67+
data-validate="{number: true, required:true, 'validate-greater-than-zero':true}"/>
6868
</div>
6969
</div>
7070
</td>

app/code/Magento/Ui/Component/Filters/Type/Search.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
namespace Magento\Ui\Component\Filters\Type;
77

88
/**
9+
* Class Search
10+
*
911
* @api
1012
* @since 100.0.2
1113
*/
@@ -34,7 +36,7 @@ protected function applyFilter()
3436
{
3537
$value = $this->getContext()->getRequestParam('search');
3638

37-
if ($value) {
39+
if ((string)$value !== '') {
3840
$filter = $this->filterBuilder->setConditionType('fulltext')
3941
->setField($this->getName())
4042
->setValue($value)

dev/tests/api-functional/testsuite/Magento/ConfigurableProduct/Api/OptionRepositoryTest.php

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
use Magento\TestFramework\Helper\Bootstrap;
1111
use Magento\Eav\Api\AttributeRepositoryInterface;
1212

13+
/**
14+
* Class OptionRepositoryTest for testing ConfigurableProductoption integration
15+
*/
1316
class OptionRepositoryTest extends \Magento\TestFramework\TestCase\WebapiAbstract
1417
{
1518
const SERVICE_NAME = 'configurableProductOptionRepositoryV1';
@@ -210,6 +213,47 @@ public function testUpdate()
210213
$this->assertEquals($requestBody['option']['label'], $configurableAttribute[0]['label']);
211214
}
212215

216+
/**
217+
* @magentoApiDataFixture Magento/ConfigurableProduct/_files/product_configurable.php
218+
*/
219+
public function testUpdateWithoutOptionId()
220+
{
221+
$productSku = 'configurable';
222+
/** @var AttributeRepositoryInterface $attributeRepository */
223+
224+
$attributeRepository = Bootstrap::getObjectManager()->create(AttributeRepositoryInterface::class);
225+
226+
/** @var \Magento\Eav\Api\Data\AttributeInterface $attribute */
227+
$attribute = $attributeRepository->get('catalog_product', 'test_configurable');
228+
229+
$serviceInfo = [
230+
'rest' => [
231+
'resourcePath' => self::RESOURCE_PATH . '/' . $productSku . '/options',
232+
'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_POST
233+
],
234+
'soap' => [
235+
'service' => self::SERVICE_NAME,
236+
'serviceVersion' => self::SERVICE_VERSION,
237+
'operation' => self::SERVICE_NAME . 'Save'
238+
]
239+
];
240+
241+
$option = [
242+
'attribute_id' => $attribute->getAttributeId(),
243+
'label' => 'Update Test Configurable with sku and attribute_id',
244+
'values' => [
245+
[
246+
'value_index' => 1,
247+
]
248+
],
249+
];
250+
251+
$result = $this->_webApiCall($serviceInfo, ['sku' => $productSku, 'option' => $option]);
252+
$this->assertGreaterThan(0, $result);
253+
$configurableAttribute = $this->getConfigurableAttribute($productSku);
254+
$this->assertEquals($option['label'], $configurableAttribute[0]['label']);
255+
}
256+
213257
/**
214258
* @param string $productSku
215259
* @return array

lib/internal/Magento/Framework/Filter/Template/Tokenizer/AbstractTokenizer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public function char()
9494
*/
9595
public function setString($value)
9696
{
97-
$this->_string = urldecode($value);
97+
$this->_string = rawurldecode($value);
9898
$this->reset();
9999
}
100100

setup/src/Magento/Setup/Console/Command/UpgradeCommand.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,10 @@ protected function execute(InputInterface $input, OutputInterface $output)
126126
$importConfigCommand = $this->getApplication()->find(ConfigImportCommand::COMMAND_NAME);
127127
$arrayInput = new ArrayInput([]);
128128
$arrayInput->setInteractive($input->isInteractive());
129-
$importConfigCommand->run($arrayInput, $output);
129+
$result = $importConfigCommand->run($arrayInput, $output);
130+
if ($result === \Magento\Framework\Console\Cli::RETURN_FAILURE) {
131+
throw new \Magento\Framework\Exception\RuntimeException(__('%1 failed. See previous output.', ConfigImportCommand::COMMAND_NAME));
132+
}
130133
}
131134

132135
if (!$keepGenerated && $this->appState->getMode() === AppState::MODE_PRODUCTION) {

0 commit comments

Comments
 (0)