diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/TierPrice/UpdateHandler.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/TierPrice/UpdateHandler.php index 500e59f26a2c3..bda92fbeab9ed 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/TierPrice/UpdateHandler.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/TierPrice/UpdateHandler.php @@ -5,8 +5,9 @@ */ namespace Magento\Catalog\Model\Product\Attribute\Backend\TierPrice; -use Magento\Framework\EntityManager\Operation\ExtensionInterface; use Magento\Catalog\Api\Data\ProductInterface; +use Magento\Framework\App\ObjectManager; +use Magento\Framework\Locale\FormatInterface; use Magento\Store\Model\StoreManagerInterface; use Magento\Catalog\Api\ProductAttributeRepositoryInterface; use Magento\Customer\Api\GroupManagementInterface; @@ -38,19 +39,26 @@ class UpdateHandler extends AbstractHandler */ private $tierPriceResource; + /** + * @var FormatInterface + */ + private $localeFormat; + /** * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Catalog\Api\ProductAttributeRepositoryInterface $attributeRepository * @param \Magento\Customer\Api\GroupManagementInterface $groupManagement * @param \Magento\Framework\EntityManager\MetadataPool $metadataPool * @param \Magento\Catalog\Model\ResourceModel\Product\Attribute\Backend\Tierprice $tierPriceResource + * @param FormatInterface|null $localeFormat */ public function __construct( StoreManagerInterface $storeManager, ProductAttributeRepositoryInterface $attributeRepository, GroupManagementInterface $groupManagement, MetadataPool $metadataPool, - Tierprice $tierPriceResource + Tierprice $tierPriceResource, + FormatInterface $localeFormat = null ) { parent::__construct($groupManagement); @@ -58,6 +66,7 @@ public function __construct( $this->attributeRepository = $attributeRepository; $this->metadataPoll = $metadataPool; $this->tierPriceResource = $tierPriceResource; + $this->localeFormat = $localeFormat ?: ObjectManager::getInstance()->get(FormatInterface::class); } /** @@ -116,8 +125,9 @@ private function updateValues(array $valuesToUpdate, array $oldValues): bool { $isChanged = false; foreach ($valuesToUpdate as $key => $value) { - if ((!empty($value['value']) && (float)$oldValues[$key]['price'] !== (float)$value['value']) - || $this->getPercentage($oldValues[$key]) !== $this->getPercentage($value) + if ((!empty($value['value']) + && (float)$oldValues[$key]['price'] !== $this->localeFormat->getNumber($value['value']) + ) || $this->getPercentage($oldValues[$key]) !== $this->getPercentage($value) ) { $price = new \Magento\Framework\DataObject( [ diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductActionGroup.xml index e68c75858102f..c00a91f030bf6 100644 --- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductActionGroup.xml +++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductActionGroup.xml @@ -248,15 +248,14 @@ - + - - - - - + + + + @@ -269,4 +268,19 @@ + + + + + + + + + + + + + + + diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontCategoryProductSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontCategoryProductSection.xml index ccb5ae60db59b..26c9035d6b136 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontCategoryProductSection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontCategoryProductSection.xml @@ -24,5 +24,6 @@ + diff --git a/app/code/Magento/CatalogInventory/Test/Mftf/Data/CatalogInventoryConfigData.xml b/app/code/Magento/CatalogInventory/Test/Mftf/Data/CatalogInventoryConfigData.xml new file mode 100644 index 0000000000000..e14c36446fc2b --- /dev/null +++ b/app/code/Magento/CatalogInventory/Test/Mftf/Data/CatalogInventoryConfigData.xml @@ -0,0 +1,23 @@ + + + + + + cataloginventory/options/show_out_of_stock + 0 + Yes + 1 + + + cataloginventory/options/show_out_of_stock + 0 + No + 0 + + diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminCreateApiConfigurableProductActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminCreateApiConfigurableProductActionGroup.xml index cdb147e99ad58..abbef02adc520 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminCreateApiConfigurableProductActionGroup.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminCreateApiConfigurableProductActionGroup.xml @@ -10,7 +10,7 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - + diff --git a/app/code/Magento/GroupedProduct/Test/Mftf/ActionGroup/AssertLinkPresenceOnGroupedProductPageActionGroup.xml b/app/code/Magento/GroupedProduct/Test/Mftf/ActionGroup/AssertLinkPresenceOnGroupedProductPageActionGroup.xml new file mode 100644 index 0000000000000..bce78f8bf9961 --- /dev/null +++ b/app/code/Magento/GroupedProduct/Test/Mftf/ActionGroup/AssertLinkPresenceOnGroupedProductPageActionGroup.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/code/Magento/GroupedProduct/Test/Mftf/Section/StorefrontProductInfoMainSection.xml b/app/code/Magento/GroupedProduct/Test/Mftf/Section/StorefrontProductInfoMainSection.xml new file mode 100644 index 0000000000000..45d8e63343734 --- /dev/null +++ b/app/code/Magento/GroupedProduct/Test/Mftf/Section/StorefrontProductInfoMainSection.xml @@ -0,0 +1,14 @@ + + + + +
+ +
+
diff --git a/lib/internal/Magento/Framework/Locale/Format.php b/lib/internal/Magento/Framework/Locale/Format.php index adcffe01b910e..c5e9ad26a25e1 100644 --- a/lib/internal/Magento/Framework/Locale/Format.php +++ b/lib/internal/Magento/Framework/Locale/Format.php @@ -10,6 +10,11 @@ */ class Format implements \Magento\Framework\Locale\FormatInterface { + /** + * Japan locale code + */ + private static $japanLocaleCode = 'ja_JP'; + /** * @var \Magento\Framework\App\ScopeResolverInterface */ @@ -81,7 +86,16 @@ public function getNumber($value) $value = str_replace(',', '', $value); } } elseif ($separatorComa !== false) { - $value = str_replace(',', '.', $value); + $locale = $this->_localeResolver->getLocale(); + /** + * It's hard code for Japan locale. + * The comma separator uses as group separator: 4,000 saves as 4,000.00 + */ + $value = str_replace( + ',', + $locale === self::$japanLocaleCode ? '' : '.', + $value + ); } return (float)$value; diff --git a/lib/internal/Magento/Framework/Locale/Test/Unit/FormatTest.php b/lib/internal/Magento/Framework/Locale/Test/Unit/FormatTest.php index f6d7326f52764..8c8e118aa3169 100644 --- a/lib/internal/Magento/Framework/Locale/Test/Unit/FormatTest.php +++ b/lib/internal/Magento/Framework/Locale/Test/Unit/FormatTest.php @@ -6,6 +6,9 @@ namespace Magento\Framework\Locale\Test\Unit; +/** + * Tests class for Number locale format + */ class FormatTest extends \PHPUnit\Framework\TestCase { /** @@ -84,25 +87,31 @@ public function testGetPriceFormat($localeCode, $expectedResult) */ public function getPriceFormatDataProvider() { + $swissGroupSymbol = INTL_ICU_VERSION >= 59.1 ? '’' : '\''; return [ ['en_US', ['decimalSymbol' => '.', 'groupSymbol' => ',']], ['de_DE', ['decimalSymbol' => ',', 'groupSymbol' => '.']], - ['de_CH', ['decimalSymbol' => '.', 'groupSymbol' => '\'']], + ['de_CH', ['decimalSymbol' => '.', 'groupSymbol' => $swissGroupSymbol]], ['uk_UA', ['decimalSymbol' => ',', 'groupSymbol' => ' ']] ]; } /** - * @param float | null $expected * @param string|float|int $value + * @param float | null $expected + * @param string $locale * @dataProvider provideNumbers */ - public function testGetNumber($value, $expected) + public function testGetNumber(string $value, float $expected, string $locale = null) { + if ($locale !== null) { + $this->localeResolver->method('getLocale')->willReturn($locale); + } $this->assertEquals($expected, $this->formatModel->getNumber($value)); } /** + * * @return array */ public function provideNumbers(): array @@ -118,6 +127,8 @@ public function provideNumbers(): array ['2 054.52', 2054.52], ['2,46 GB', 2.46], ['2,054.00', 2054], + ['4,000', 4000.0, 'ja_JP'], + ['4,000', 4.0, 'en_US'], ]; } } diff --git a/lib/web/mage/requirejs/resolver.js b/lib/web/mage/requirejs/resolver.js index 588a0f8411cff..5ba1f1351bcf6 100644 --- a/lib/web/mage/requirejs/resolver.js +++ b/lib/web/mage/requirejs/resolver.js @@ -34,7 +34,7 @@ define([ * @return {Boolean} */ function isRejected(module) { - return registry[module.id] && registry[module.id].error; + return registry[module.id] && (registry[module.id].inited || registry[module.id].error); } /**