Skip to content

Commit 85429d7

Browse files
authored
Merge pull request #4107 from magento-tango/MAGETWO-99027
[tango] MAGETWO-99027: Customizable Option Price input is not saved on Store View level when Catalog Price Scope set to Global
2 parents c43ba2d + 0218762 commit 85429d7

File tree

1 file changed

+13
-3
lines changed
  • app/code/Magento/Catalog/Model/ResourceModel/Product/Option

1 file changed

+13
-3
lines changed

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

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@
1717
use Magento\Store\Model\ScopeInterface;
1818
use Magento\Store\Model\Store;
1919
use Magento\Store\Model\StoreManagerInterface;
20+
use Magento\Catalog\Helper\Data;
2021

2122
/**
2223
* Catalog product custom option resource model
2324
*
24-
* @author Magento Core Team <core@magentocommerce.com>
25+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2526
*/
2627
class Value extends AbstractDb
2728
{
@@ -51,6 +52,11 @@ class Value extends AbstractDb
5152
*/
5253
private $localeFormat;
5354

55+
/**
56+
* @var Data
57+
*/
58+
private $dataHelper;
59+
5460
/**
5561
* Class constructor
5662
*
@@ -59,17 +65,21 @@ class Value extends AbstractDb
5965
* @param StoreManagerInterface $storeManager
6066
* @param ScopeConfigInterface $config
6167
* @param string $connectionName
68+
* @param Data $dataHelper
6269
*/
6370
public function __construct(
6471
Context $context,
6572
CurrencyFactory $currencyFactory,
6673
StoreManagerInterface $storeManager,
6774
ScopeConfigInterface $config,
68-
$connectionName = null
75+
$connectionName = null,
76+
Data $dataHelper = null
6977
) {
7078
$this->_currencyFactory = $currencyFactory;
7179
$this->_storeManager = $storeManager;
7280
$this->_config = $config;
81+
$this->dataHelper = $dataHelper ?: ObjectManager::getInstance()
82+
->get(Data::class);
7383
parent::__construct($context, $connectionName);
7484
}
7585

@@ -131,7 +141,7 @@ protected function _saveValuePrices(AbstractModel $object)
131141
$optionTypeId = $this->getConnection()->fetchOne($select);
132142

133143
if ($optionTypeId) {
134-
if ($object->getStoreId() == '0') {
144+
if ($object->getStoreId() == '0' || $this->dataHelper->isPriceGlobal()) {
135145
$bind = ['price' => $price, 'price_type' => $priceType];
136146
$where = [
137147
'option_type_id = ?' => $optionTypeId,

0 commit comments

Comments
 (0)