From 9906804c4ad1f431d621b408d2c1691fddc33776 Mon Sep 17 00:00:00 2001 From: abhattGlo Date: Wed, 27 Jul 2022 16:46:25 +0530 Subject: [PATCH 1/9] AC2678:Product customizable options incorrect after import options sort order was submitted incorrectly in form request --- .../web/js/components/dynamic-rows-import-custom-options.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/components/dynamic-rows-import-custom-options.js b/app/code/Magento/Catalog/view/adminhtml/web/js/components/dynamic-rows-import-custom-options.js index bcc5ad451a533..5bacb5038059a 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/js/components/dynamic-rows-import-custom-options.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/js/components/dynamic-rows-import-custom-options.js @@ -40,10 +40,6 @@ define([ _.each(item.options, function (option) { currentOption = utils.copy(option); - if (currentOption.hasOwnProperty('sort_order')) { - delete currentOption['sort_order']; - } - if (currentOption.hasOwnProperty('option_id')) { delete currentOption['option_id']; } From 5c7c4092a37eecf847c0ed3eaf9e95ae67fddd4d Mon Sep 17 00:00:00 2001 From: abhattGlo Date: Wed, 27 Jul 2022 18:15:08 +0530 Subject: [PATCH 2/9] AC2678:Product customizable options incorrect after import options Fixed failing test case. --- .../js/components/dynamic-rows-import-custom-options.test.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Catalog/adminhtml/js/components/dynamic-rows-import-custom-options.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Catalog/adminhtml/js/components/dynamic-rows-import-custom-options.test.js index 3e904cd63821c..50be7a11c4c3e 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/Catalog/adminhtml/js/components/dynamic-rows-import-custom-options.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Catalog/adminhtml/js/components/dynamic-rows-import-custom-options.test.js @@ -26,7 +26,6 @@ define([ data = [{ 'options': [ { - 'sort_order': 1, 'option_id': 1, 'option_type_id': 1, 'values': [{ @@ -36,7 +35,6 @@ define([ }] }, { - 'sort_order': 2, 'option_id': 2, 'option_type_id': 2, 'values': [{ From eb02e7a4715169bc24261159da9bb0573fdb0ab2 Mon Sep 17 00:00:00 2001 From: glo37161 Date: Tue, 9 Aug 2022 14:04:46 +0530 Subject: [PATCH 3/9] AC-5986::Unable to update cart item custom option values with REST API --- .../Model/Quote/Item/CartItemPersister.php | 2 + .../Quote/Api/GuestCartAddingItemsTest.php | 92 +++++++++++++++++++ .../product_simple_with_custom_options.php | 2 +- 3 files changed, 95 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Quote/Model/Quote/Item/CartItemPersister.php b/app/code/Magento/Quote/Model/Quote/Item/CartItemPersister.php index 41651d3c788a4..727e77b3e4ff0 100644 --- a/app/code/Magento/Quote/Model/Quote/Item/CartItemPersister.php +++ b/app/code/Magento/Quote/Model/Quote/Item/CartItemPersister.php @@ -77,6 +77,8 @@ public function save(CartInterface $quote, CartItemInterface $item) /** Update item product options */ if ($currentItem->getQty() !== $buyRequestData->getQty()) { $item = $quote->updateItem($itemId, $buyRequestData); + } else { + $item = $quote->updateItem($itemId, $buyRequestData); } } else { if ($item->getQty() !== $currentItem->getQty()) { diff --git a/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCartAddingItemsTest.php b/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCartAddingItemsTest.php index 66f3c5d7874c5..faf809f9367c6 100644 --- a/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCartAddingItemsTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCartAddingItemsTest.php @@ -117,4 +117,96 @@ public function testPriceForCreatingQuoteFromEmptyCart() $quote->load($quoteId); $quote->delete(); } + + /** + * Test add to product with custom option and test with updating custom options. + * + * @magentoApiDataFixture Magento/Catalog/_files/product_simple_with_custom_options.php + * @return void + */ + public function testAddtoCartWithCustomOptionsForCreatingQuoteFromEmptyCart() + { + // Creating empty cart + $serviceInfoForCreatingEmptyCart = [ + 'rest' => [ + 'resourcePath' => self::RESOURCE_PATH, + 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_POST, + ], + 'soap' => [ + 'service' => self::SERVICE_NAME, + 'serviceVersion' => self::SERVICE_VERSION, + 'operation' => self::SERVICE_NAME . 'CreateEmptyCart', + ], + ]; + $quoteId = $this->_webApiCall($serviceInfoForCreatingEmptyCart); + + // Adding item to the cart + $serviceInfoForAddingProduct = [ + 'rest' => [ + 'resourcePath' => self::RESOURCE_PATH . $quoteId . '/items', + 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_POST, + ], + 'soap' => [ + 'service' => GuestCartItemRepositoryTest::SERVICE_NAME, + 'serviceVersion' => self::SERVICE_VERSION, + 'operation' => GuestCartItemRepositoryTest::SERVICE_NAME . 'Save', + ], + ]; + $requestData = [ + 'cartItem' => [ + 'quote_id' => $quoteId, + 'sku' => 'simple_with_custom_options', + 'qty' => 1, + 'product_option' => [ + 'extension_attributes' => [ + 'custom_options' => [ + ['option_id' => 1, 'option_value' => 1], + ['option_id' => 2, 'option_value' => 1], + ['option_id' => 3, 'option_value' => 'test'] + ] + ] + ] + ] + ]; + $item = $this->_webApiCall($serviceInfoForAddingProduct, $requestData); + $this->assertNotEmpty($item); + + $requestData = [ + 'cartItem' => [ + 'quote_id' => $quoteId, + 'sku' => 'simple_with_custom_options', + 'qty' => 1, + 'product_option' => [ + 'extension_attributes' => [ + 'custom_options' => [ + ['option_id' => 1, 'option_value' => 2], + ['option_id' => 2, 'option_value' => 2], + ['option_id' => 3, 'option_value' => 'test2'] + ] + ] + ] + ] + ]; + + // Delete the item for the cart + $serviceInfoForUpdateProduct = [ + 'rest' => [ + 'resourcePath' => self::RESOURCE_PATH . $quoteId . '/items/' . $item['item_id'], + 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_PUT, + ], + 'soap' => [ + 'service' => GuestCartItemRepositoryTest::SERVICE_NAME, + 'serviceVersion' => self::SERVICE_VERSION, + 'operation' => GuestCartItemRepositoryTest::SERVICE_NAME . 'Save', + ], + ]; + + $item = $this->_webApiCall($serviceInfoForUpdateProduct, $requestData); + $this->assertNotEmpty($item); + + /** @var \Magento\Quote\Model\Quote $quote */ + $quote = $this->objectManager->create(\Magento\Quote\Model\Quote::class); + $quote->load($quoteId); + $quote->delete(); + } } diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_custom_options.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_custom_options.php index 61b549f7729d1..9a2e63f2e4ad6 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_custom_options.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple_with_custom_options.php @@ -35,7 +35,7 @@ 'use_config_manage_stock' => 1, 'qty' => 100, 'is_qty_decimal' => 0, - 'is_in_stock' => 1, + 'is_in_stock' => 2, ] )->setCanSaveCustomOptions(true) ->setHasOptions(true); From 7e64392e524875d88c3c9c3041c70b72c270e1c6 Mon Sep 17 00:00:00 2001 From: glo37161 Date: Tue, 9 Aug 2022 14:09:17 +0530 Subject: [PATCH 4/9] AC-5986::Unable to update cart item custom option values with REST API - updated comment --- .../testsuite/Magento/Quote/Api/GuestCartAddingItemsTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCartAddingItemsTest.php b/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCartAddingItemsTest.php index faf809f9367c6..0d7dc242f6832 100644 --- a/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCartAddingItemsTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCartAddingItemsTest.php @@ -188,7 +188,7 @@ public function testAddtoCartWithCustomOptionsForCreatingQuoteFromEmptyCart() ] ]; - // Delete the item for the cart + // Update the item for the cart $serviceInfoForUpdateProduct = [ 'rest' => [ 'resourcePath' => self::RESOURCE_PATH . $quoteId . '/items/' . $item['item_id'], From 56ebc38a38fab68c706335a406f01dbac7dd1960 Mon Sep 17 00:00:00 2001 From: glo37161 Date: Tue, 9 Aug 2022 19:10:48 +0530 Subject: [PATCH 5/9] AC-5986::Unable to update cart item custom option values with REST API-fixed static test failure --- .../Quote/Api/GuestCartAddingItemsTest.php | 181 ++++++++---------- 1 file changed, 82 insertions(+), 99 deletions(-) diff --git a/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCartAddingItemsTest.php b/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCartAddingItemsTest.php index 0d7dc242f6832..3074b077c5656 100644 --- a/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCartAddingItemsTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCartAddingItemsTest.php @@ -7,6 +7,8 @@ namespace Magento\Quote\Api; +use Magento\Framework\Webapi\Rest\Request; +use Magento\Quote\Model\Quote; use Magento\TestFramework\TestCase\WebapiAbstract; /** @@ -14,9 +16,9 @@ */ class GuestCartAddingItemsTest extends WebapiAbstract { - const SERVICE_VERSION = 'V1'; - const SERVICE_NAME = 'quoteGuestCartManagementV1'; - const RESOURCE_PATH = '/V1/guest-carts/'; + private const SERVICE_VERSION = 'V1'; + private const SERVICE_NAME = 'quoteGuestCartManagementV1'; + private const RESOURCE_PATH = '/V1/guest-carts/'; /** * @var \Magento\TestFramework\ObjectManager @@ -29,24 +31,20 @@ protected function setUp(): void } /** - * Test price for cart after deleting and adding product to. + * Test add to product with custom option and test with updating custom options. * - * @magentoApiDataFixture Magento/Catalog/_files/product_without_options_with_stock_data.php + * @magentoApiDataFixture Magento/Catalog/_files/product_simple_with_custom_options.php * @return void */ - public function testPriceForCreatingQuoteFromEmptyCart() + public function testAddtoCartWithCustomOptionsForCreatingQuoteFromEmptyCart() { + $this->_markTestAsRestOnly(); // Creating empty cart $serviceInfoForCreatingEmptyCart = [ 'rest' => [ 'resourcePath' => self::RESOURCE_PATH, - 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_POST, - ], - 'soap' => [ - 'service' => self::SERVICE_NAME, - 'serviceVersion' => self::SERVICE_VERSION, - 'operation' => self::SERVICE_NAME . 'CreateEmptyCart', - ], + 'httpMethod' => Request::HTTP_METHOD_POST, + ] ]; $quoteId = $this->_webApiCall($serviceInfoForCreatingEmptyCart); @@ -54,83 +52,70 @@ public function testPriceForCreatingQuoteFromEmptyCart() $serviceInfoForAddingProduct = [ 'rest' => [ 'resourcePath' => self::RESOURCE_PATH . $quoteId . '/items', - 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_POST, - ], - 'soap' => [ - 'service' => GuestCartItemRepositoryTest::SERVICE_NAME, - 'serviceVersion' => self::SERVICE_VERSION, - 'operation' => GuestCartItemRepositoryTest::SERVICE_NAME . 'Save', - ], + 'httpMethod' => Request::HTTP_METHOD_POST, + ] ]; $requestData = [ 'cartItem' => [ 'quote_id' => $quoteId, - 'sku' => 'simple', - 'qty' => 1 + 'sku' => 'simple_with_custom_options', + 'qty' => 1, + 'product_option' => [ + 'extension_attributes' => [ + 'custom_options' => [ + ['option_id' => 1, 'option_value' => 1], + ['option_id' => 2, 'option_value' => 1], + ['option_id' => 3, 'option_value' => 'test'] + ] + ] + ] ] ]; $item = $this->_webApiCall($serviceInfoForAddingProduct, $requestData); $this->assertNotEmpty($item); - // Delete the item for the cart - $serviceInfoForDeleteProduct = [ - 'rest' => [ - 'resourcePath' => self::RESOURCE_PATH . $quoteId . '/items/' . $item['item_id'], - 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_DELETE, - ], - 'soap' => [ - 'service' => GuestCartItemRepositoryTest::SERVICE_NAME, - 'serviceVersion' => self::SERVICE_VERSION, - 'operation' => GuestCartItemRepositoryTest::SERVICE_NAME . 'deleteById', - ], - ]; - $response = (TESTS_WEB_API_ADAPTER == self::ADAPTER_SOAP) ? - $this->_webApiCall($serviceInfoForDeleteProduct, ['cartId' => $quoteId, 'itemId' => $item['item_id']]) - : $this->_webApiCall($serviceInfoForDeleteProduct); - $this->assertTrue($response); - - // Add one more item and check price for this item - $serviceInfoForAddingProduct = [ - 'rest' => [ - 'resourcePath' => self::RESOURCE_PATH . $quoteId . '/items', - 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_POST, - ], - 'soap' => [ - 'service' => GuestCartItemRepositoryTest::SERVICE_NAME, - 'serviceVersion' => self::SERVICE_VERSION, - 'operation' => GuestCartItemRepositoryTest::SERVICE_NAME . 'Save', - ], - ]; $requestData = [ 'cartItem' => [ 'quote_id' => $quoteId, - 'sku' => 'simple', - 'qty' => 1 + 'sku' => 'simple_with_custom_options', + 'qty' => 1, + 'product_option' => [ + 'extension_attributes' => [ + 'custom_options' => [ + ['option_id' => 1, 'option_value' => 2], + ['option_id' => 2, 'option_value' => 2], + ['option_id' => 3, 'option_value' => 'test2'] + ] + ] + ] ] ]; - $item = $this->_webApiCall($serviceInfoForAddingProduct, $requestData); - $this->assertNotEmpty($item); - $this->assertEquals($item['price'], 10); - /** @var \Magento\Quote\Model\Quote $quote */ - $quote = $this->objectManager->create(\Magento\Quote\Model\Quote::class); - $quote->load($quoteId); - $quote->delete(); + // Update the item for the cart + $serviceInfoForUpdateProduct = [ + 'rest' => [ + 'resourcePath' => self::RESOURCE_PATH . $quoteId . '/items/' . $item['item_id'], + 'httpMethod' => Request::HTTP_METHOD_PUT, + ] + ]; + + $item = $this->_webApiCall($serviceInfoForUpdateProduct, $requestData); + $this->assertNotEmpty($item); } /** - * Test add to product with custom option and test with updating custom options. + * Test price for cart after deleting and adding product to. * - * @magentoApiDataFixture Magento/Catalog/_files/product_simple_with_custom_options.php + * @magentoApiDataFixture Magento/Catalog/_files/product_without_options_with_stock_data.php * @return void */ - public function testAddtoCartWithCustomOptionsForCreatingQuoteFromEmptyCart() + public function testPriceForCreatingQuoteFromEmptyCart() { // Creating empty cart $serviceInfoForCreatingEmptyCart = [ 'rest' => [ 'resourcePath' => self::RESOURCE_PATH, - 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_POST, + 'httpMethod' => Request::HTTP_METHOD_POST, ], 'soap' => [ 'service' => self::SERVICE_NAME, @@ -144,7 +129,7 @@ public function testAddtoCartWithCustomOptionsForCreatingQuoteFromEmptyCart() $serviceInfoForAddingProduct = [ 'rest' => [ 'resourcePath' => self::RESOURCE_PATH . $quoteId . '/items', - 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_POST, + 'httpMethod' => Request::HTTP_METHOD_POST, ], 'soap' => [ 'service' => GuestCartItemRepositoryTest::SERVICE_NAME, @@ -155,44 +140,35 @@ public function testAddtoCartWithCustomOptionsForCreatingQuoteFromEmptyCart() $requestData = [ 'cartItem' => [ 'quote_id' => $quoteId, - 'sku' => 'simple_with_custom_options', - 'qty' => 1, - 'product_option' => [ - 'extension_attributes' => [ - 'custom_options' => [ - ['option_id' => 1, 'option_value' => 1], - ['option_id' => 2, 'option_value' => 1], - ['option_id' => 3, 'option_value' => 'test'] - ] - ] - ] + 'sku' => 'simple', + 'qty' => 1 ] ]; $item = $this->_webApiCall($serviceInfoForAddingProduct, $requestData); $this->assertNotEmpty($item); - $requestData = [ - 'cartItem' => [ - 'quote_id' => $quoteId, - 'sku' => 'simple_with_custom_options', - 'qty' => 1, - 'product_option' => [ - 'extension_attributes' => [ - 'custom_options' => [ - ['option_id' => 1, 'option_value' => 2], - ['option_id' => 2, 'option_value' => 2], - ['option_id' => 3, 'option_value' => 'test2'] - ] - ] - ] - ] + // Delete the item for the cart + $serviceInfoForDeleteProduct = [ + 'rest' => [ + 'resourcePath' => self::RESOURCE_PATH . $quoteId . '/items/' . $item['item_id'], + 'httpMethod' => Request::HTTP_METHOD_DELETE, + ], + 'soap' => [ + 'service' => GuestCartItemRepositoryTest::SERVICE_NAME, + 'serviceVersion' => self::SERVICE_VERSION, + 'operation' => GuestCartItemRepositoryTest::SERVICE_NAME . 'deleteById', + ], ]; + $response = (TESTS_WEB_API_ADAPTER == self::ADAPTER_SOAP) ? + $this->_webApiCall($serviceInfoForDeleteProduct, ['cartId' => $quoteId, 'itemId' => $item['item_id']]) + : $this->_webApiCall($serviceInfoForDeleteProduct); + $this->assertTrue($response); - // Update the item for the cart - $serviceInfoForUpdateProduct = [ + // Add one more item and check price for this item + $serviceInfoForAddingProduct = [ 'rest' => [ - 'resourcePath' => self::RESOURCE_PATH . $quoteId . '/items/' . $item['item_id'], - 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_PUT, + 'resourcePath' => self::RESOURCE_PATH . $quoteId . '/items', + 'httpMethod' => Request::HTTP_METHOD_POST, ], 'soap' => [ 'service' => GuestCartItemRepositoryTest::SERVICE_NAME, @@ -200,12 +176,19 @@ public function testAddtoCartWithCustomOptionsForCreatingQuoteFromEmptyCart() 'operation' => GuestCartItemRepositoryTest::SERVICE_NAME . 'Save', ], ]; - - $item = $this->_webApiCall($serviceInfoForUpdateProduct, $requestData); + $requestData = [ + 'cartItem' => [ + 'quote_id' => $quoteId, + 'sku' => 'simple', + 'qty' => 1 + ] + ]; + $item = $this->_webApiCall($serviceInfoForAddingProduct, $requestData); $this->assertNotEmpty($item); + $this->assertEquals($item['price'], 10); - /** @var \Magento\Quote\Model\Quote $quote */ - $quote = $this->objectManager->create(\Magento\Quote\Model\Quote::class); + /** @var Quote $quote */ + $quote = $this->objectManager->create(Quote::class); $quote->load($quoteId); $quote->delete(); } From 77d3dbdb8b70ddcd1e76302500ffd5421322428f Mon Sep 17 00:00:00 2001 From: glo37161 Date: Wed, 10 Aug 2022 13:53:14 +0530 Subject: [PATCH 6/9] AC-5986::Unable to update cart item custom option values with REST API-Fixed Webapi test failure --- .../Quote/Api/GuestCartAddingItemsTest.php | 40 +++++++++++++------ 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCartAddingItemsTest.php b/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCartAddingItemsTest.php index 3074b077c5656..e1521b52be322 100644 --- a/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCartAddingItemsTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCartAddingItemsTest.php @@ -7,8 +7,12 @@ namespace Magento\Quote\Api; +use Magento\Catalog\Model\Product; +use Magento\Catalog\Model\Product\Option; +use Magento\Catalog\Model\ResourceModel\Product as ProductResource; use Magento\Framework\Webapi\Rest\Request; use Magento\Quote\Model\Quote; +use Magento\TestFramework\Helper\Bootstrap; use Magento\TestFramework\TestCase\WebapiAbstract; /** @@ -27,7 +31,8 @@ class GuestCartAddingItemsTest extends WebapiAbstract protected function setUp(): void { - $this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $this->objectManager = Bootstrap::getObjectManager(); + $this->productResource = $this->objectManager->get(ProductResource::class); } /** @@ -39,6 +44,19 @@ protected function setUp(): void public function testAddtoCartWithCustomOptionsForCreatingQuoteFromEmptyCart() { $this->_markTestAsRestOnly(); + + $productId = $this->productResource->getIdBySku('simple_with_custom_options'); + $product = $this->objectManager->create(Product::class)->load($productId); + $customOptionCollection = $this->objectManager->get(Option::class) + ->getProductOptionCollection($product); + $customOptions = []; + foreach ($customOptionCollection as $option) { + $customOptions [] = [ + 'option_id' => $option->getId(), + 'option_value' => $option->getType() !== 'field' ? 1 : 'test' + ]; + } + // Creating empty cart $serviceInfoForCreatingEmptyCart = [ 'rest' => [ @@ -55,6 +73,7 @@ public function testAddtoCartWithCustomOptionsForCreatingQuoteFromEmptyCart() 'httpMethod' => Request::HTTP_METHOD_POST, ] ]; + $requestData = [ 'cartItem' => [ 'quote_id' => $quoteId, @@ -62,18 +81,19 @@ public function testAddtoCartWithCustomOptionsForCreatingQuoteFromEmptyCart() 'qty' => 1, 'product_option' => [ 'extension_attributes' => [ - 'custom_options' => [ - ['option_id' => 1, 'option_value' => 1], - ['option_id' => 2, 'option_value' => 1], - ['option_id' => 3, 'option_value' => 'test'] - ] + 'custom_options' => $customOptions ] ] ] ]; $item = $this->_webApiCall($serviceInfoForAddingProduct, $requestData); $this->assertNotEmpty($item); - + foreach ($customOptionCollection as $option) { + $customOptions [] = [ + 'option_id' => $option->getId(), + 'option_value' => $option->getType() != 'field' ? 2 : 'test2' + ]; + } $requestData = [ 'cartItem' => [ 'quote_id' => $quoteId, @@ -81,11 +101,7 @@ public function testAddtoCartWithCustomOptionsForCreatingQuoteFromEmptyCart() 'qty' => 1, 'product_option' => [ 'extension_attributes' => [ - 'custom_options' => [ - ['option_id' => 1, 'option_value' => 2], - ['option_id' => 2, 'option_value' => 2], - ['option_id' => 3, 'option_value' => 'test2'] - ] + 'custom_options' => $customOptions ] ] ] From c494cbab55751c79d4471efc70afa7004b68b053 Mon Sep 17 00:00:00 2001 From: glo37161 Date: Wed, 10 Aug 2022 15:07:14 +0530 Subject: [PATCH 7/9] AC-5986::Unable to update cart item custom option values with REST API-Fixed Static test failure --- .../testsuite/Magento/Quote/Api/GuestCartAddingItemsTest.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCartAddingItemsTest.php b/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCartAddingItemsTest.php index e1521b52be322..a27c36847a1d3 100644 --- a/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCartAddingItemsTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCartAddingItemsTest.php @@ -28,6 +28,11 @@ class GuestCartAddingItemsTest extends WebapiAbstract * @var \Magento\TestFramework\ObjectManager */ protected $objectManager; + + /** + * @var ProductResource|mixed + */ + private mixed $productResource; protected function setUp(): void { From bb55549cd3016987663272e7ffe3f452c8d6e40d Mon Sep 17 00:00:00 2001 From: Nishant Rana Date: Tue, 16 Aug 2022 13:21:43 +0530 Subject: [PATCH 8/9] AC-6384: Fix for empty catalog page issue after Admin config change --- .../frontend/templates/product/list/toolbar/limiter.phtml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/list/toolbar/limiter.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/list/toolbar/limiter.phtml index fd20210af389f..04b0fe6966289 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/list/toolbar/limiter.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/list/toolbar/limiter.phtml @@ -23,7 +23,9 @@ isLimitCurrent($_key)):?> selected="selected" > - escapeHtml($localeFormatter->formatNumber((int) $_limit)) ?> + escapeHtml( + is_numeric($_limit) ? $localeFormatter->formatNumber((int) $_limit) : $_limit + ) ?> From 07868fddd7784e5ab7dfbd997fd050e757114b64 Mon Sep 17 00:00:00 2001 From: glo37161 Date: Thu, 18 Aug 2022 17:05:32 +0530 Subject: [PATCH 9/9] Fix the conflict between ACP2E-74 Fixes --- app/code/Magento/Quote/Model/Quote/Item/CartItemPersister.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/code/Magento/Quote/Model/Quote/Item/CartItemPersister.php b/app/code/Magento/Quote/Model/Quote/Item/CartItemPersister.php index 727e77b3e4ff0..5481f57695d11 100644 --- a/app/code/Magento/Quote/Model/Quote/Item/CartItemPersister.php +++ b/app/code/Magento/Quote/Model/Quote/Item/CartItemPersister.php @@ -75,9 +75,7 @@ public function save(CartInterface $quote, CartItemInterface $item) $buyRequestData = $this->cartItemOptionProcessor->getBuyRequest($productType, $item); if (is_object($buyRequestData)) { /** Update item product options */ - if ($currentItem->getQty() !== $buyRequestData->getQty()) { - $item = $quote->updateItem($itemId, $buyRequestData); - } else { + if ($quote->getIsActive()) { $item = $quote->updateItem($itemId, $buyRequestData); } } else {