|
7 | 7 |
|
8 | 8 | namespace Magento\Catalog\Model\Product\Attribute\Backend\TierPrice;
|
9 | 9 |
|
10 |
| -use Magento\Framework\EntityManager\Operation\ExtensionInterface; |
11 | 10 | use Magento\Catalog\Api\Data\ProductInterface;
|
| 11 | +use Magento\Framework\App\ObjectManager; |
| 12 | +use Magento\Framework\Locale\FormatInterface; |
12 | 13 | use Magento\Store\Model\StoreManagerInterface;
|
13 | 14 | use Magento\Catalog\Api\ProductAttributeRepositoryInterface;
|
14 | 15 | use Magento\Customer\Api\GroupManagementInterface;
|
@@ -40,26 +41,34 @@ class UpdateHandler extends AbstractHandler
|
40 | 41 | */
|
41 | 42 | private $tierPriceResource;
|
42 | 43 |
|
| 44 | + /** |
| 45 | + * @var FormatInterface |
| 46 | + */ |
| 47 | + private $localeFormat; |
| 48 | + |
43 | 49 | /**
|
44 | 50 | * @param \Magento\Store\Model\StoreManagerInterface $storeManager
|
45 | 51 | * @param \Magento\Catalog\Api\ProductAttributeRepositoryInterface $attributeRepository
|
46 | 52 | * @param \Magento\Customer\Api\GroupManagementInterface $groupManagement
|
47 | 53 | * @param \Magento\Framework\EntityManager\MetadataPool $metadataPool
|
48 | 54 | * @param \Magento\Catalog\Model\ResourceModel\Product\Attribute\Backend\Tierprice $tierPriceResource
|
| 55 | + * @param FormatInterface|null $localeFormat |
49 | 56 | */
|
50 | 57 | public function __construct(
|
51 | 58 | StoreManagerInterface $storeManager,
|
52 | 59 | ProductAttributeRepositoryInterface $attributeRepository,
|
53 | 60 | GroupManagementInterface $groupManagement,
|
54 | 61 | MetadataPool $metadataPool,
|
55 |
| - Tierprice $tierPriceResource |
| 62 | + Tierprice $tierPriceResource, |
| 63 | + FormatInterface $localeFormat = null |
56 | 64 | ) {
|
57 | 65 | parent::__construct($groupManagement);
|
58 | 66 |
|
59 | 67 | $this->storeManager = $storeManager;
|
60 | 68 | $this->attributeRepository = $attributeRepository;
|
61 | 69 | $this->metadataPoll = $metadataPool;
|
62 | 70 | $this->tierPriceResource = $tierPriceResource;
|
| 71 | + $this->localeFormat = $localeFormat ?: ObjectManager::getInstance()->get(FormatInterface::class); |
63 | 72 | }
|
64 | 73 |
|
65 | 74 | /**
|
@@ -125,8 +134,9 @@ private function updateValues(array $valuesToUpdate, array $oldValues): bool
|
125 | 134 | {
|
126 | 135 | $isChanged = false;
|
127 | 136 | foreach ($valuesToUpdate as $key => $value) {
|
128 |
| - if ((!empty($value['value']) && (float)$oldValues[$key]['price'] !== (float)$value['value']) |
129 |
| - || $this->getPercentage($oldValues[$key]) !== $this->getPercentage($value) |
| 137 | + if ((!empty($value['value']) |
| 138 | + && (float)$oldValues[$key]['price'] !== $this->localeFormat->getNumber($value['value']) |
| 139 | + ) || $this->getPercentage($oldValues[$key]) !== $this->getPercentage($value) |
130 | 140 | ) {
|
131 | 141 | $price = new \Magento\Framework\DataObject(
|
132 | 142 | [
|
|
0 commit comments