Skip to content

Commit 4ff24c2

Browse files
committed
Resolve Use Default Store View Constant instead of '0'
1 parent 80ae9bd commit 4ff24c2

File tree

3 files changed

+61
-5
lines changed
  • app/code/Magento

3 files changed

+61
-5
lines changed

app/code/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option.php

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77

88
use Magento\Framework\Data\Form\Element\AbstractElement;
99

10+
/**
11+
* Class \Magento\Bundle\Block\Adminhtml\Catalog\Product\Edit\Tab\Bundle\Option
12+
*/
1013
class Option extends \Magento\Backend\Block\Widget
1114
{
1215
/**
@@ -79,6 +82,8 @@ protected function _construct()
7982
}
8083

8184
/**
85+
* Return Field Id
86+
*
8287
* @return string
8388
*/
8489
public function getFieldId()
@@ -87,6 +92,8 @@ public function getFieldId()
8792
}
8893

8994
/**
95+
* Return Field Name
96+
*
9097
* @return string
9198
*/
9299
public function getFieldName()
@@ -108,6 +115,8 @@ public function getProduct()
108115
}
109116

110117
/**
118+
* Render
119+
*
111120
* @param AbstractElement $element
112121
* @return string
113122
*/
@@ -118,6 +127,8 @@ public function render(AbstractElement $element)
118127
}
119128

120129
/**
130+
* Set Element
131+
*
121132
* @param AbstractElement $element
122133
* @return $this
123134
*/
@@ -128,6 +139,8 @@ public function setElement(AbstractElement $element)
128139
}
129140

130141
/**
142+
* Get Element
143+
*
131144
* @return AbstractElement|null
132145
*/
133146
public function getElement()
@@ -136,6 +149,8 @@ public function getElement()
136149
}
137150

138151
/**
152+
* Return Is Multi Websites
153+
*
139154
* @return bool
140155
*/
141156
public function isMultiWebsites()
@@ -144,6 +159,8 @@ public function isMultiWebsites()
144159
}
145160

146161
/**
162+
* Prepare Layout
163+
*
147164
* @return $this
148165
*/
149166
protected function _prepareLayout()
@@ -184,6 +201,8 @@ protected function _prepareLayout()
184201
}
185202

186203
/**
204+
* Get Add Button Html
205+
*
187206
* @return string
188207
*/
189208
public function getAddButtonHtml()
@@ -192,6 +211,8 @@ public function getAddButtonHtml()
192211
}
193212

194213
/**
214+
* Get Close Search Button Html
215+
*
195216
* @return string
196217
*/
197218
public function getCloseSearchButtonHtml()
@@ -200,6 +221,8 @@ public function getCloseSearchButtonHtml()
200221
}
201222

202223
/**
224+
* Get Add Selection Button Html
225+
*
203226
* @return string
204227
*/
205228
public function getAddSelectionButtonHtml()
@@ -239,6 +262,8 @@ public function getOptions()
239262
}
240263

241264
/**
265+
* Get Add Button Id
266+
*
242267
* @return mixed
243268
*/
244269
public function getAddButtonId()
@@ -248,6 +273,8 @@ public function getAddButtonId()
248273
}
249274

250275
/**
276+
* Get Options Delete Button Html
277+
*
251278
* @return string
252279
*/
253280
public function getOptionDeleteButtonHtml()
@@ -256,6 +283,8 @@ public function getOptionDeleteButtonHtml()
256283
}
257284

258285
/**
286+
* Get Selection Html
287+
*
259288
* @return string
260289
*/
261290
public function getSelectionHtml()
@@ -264,6 +293,8 @@ public function getSelectionHtml()
264293
}
265294

266295
/**
296+
* Get Type Select Html
297+
*
267298
* @return mixed
268299
*/
269300
public function getTypeSelectHtml()
@@ -286,6 +317,8 @@ public function getTypeSelectHtml()
286317
}
287318

288319
/**
320+
* Get Require Select Html
321+
*
289322
* @return mixed
290323
*/
291324
public function getRequireSelectHtml()
@@ -304,10 +337,12 @@ public function getRequireSelectHtml()
304337
}
305338

306339
/**
340+
* Return Is Default Store
341+
*
307342
* @return bool
308343
*/
309344
public function isDefaultStore()
310345
{
311-
return $this->getProduct()->getStoreId() == '0';
346+
return $this->getProduct()->getStoreId() == \Magento\Store\Model\Store::DEFAULT_STORE_ID;
312347
}
313348
}

app/code/Magento/Bundle/Ui/DataProvider/Product/Form/Modifier/BundlePanel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -814,6 +814,6 @@ protected function getSelectionPriceType()
814814
*/
815815
protected function isDefaultStore()
816816
{
817-
return $this->locator->getProduct()->getStoreId() == 0;
817+
return $this->locator->getProduct()->getStoreId() == \Magento\Store\Model\Store::DEFAULT_STORE_ID;
818818
}
819819
}

app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Options/Option.php

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
use Magento\Catalog\Api\Data\ProductCustomOptionInterface;
1515

1616
/**
17+
* Class \Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Options\Option
18+
*
1719
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1820
*/
1921
class Option extends Widget
@@ -105,6 +107,8 @@ protected function _construct()
105107
}
106108

107109
/**
110+
* Get Item Count
111+
*
108112
* @return int
109113
*/
110114
public function getItemCount()
@@ -113,6 +117,8 @@ public function getItemCount()
113117
}
114118

115119
/**
120+
* Set Item Count
121+
*
116122
* @param int $itemCount
117123
* @return $this
118124
*/
@@ -142,6 +148,8 @@ public function getProduct()
142148
}
143149

144150
/**
151+
* Set Product
152+
*
145153
* @param Product $product
146154
* @return $this
147155
*/
@@ -182,6 +190,8 @@ public function isReadonly()
182190
}
183191

184192
/**
193+
* Prepare Layout
194+
*
185195
* @return $this
186196
*/
187197
protected function _prepareLayout()
@@ -194,6 +204,8 @@ protected function _prepareLayout()
194204
}
195205

196206
/**
207+
* Get Add Button Id
208+
*
197209
* @return mixed
198210
*/
199211
public function getAddButtonId()
@@ -203,6 +215,8 @@ public function getAddButtonId()
203215
}
204216

205217
/**
218+
* Get Type Select Html
219+
*
206220
* @return mixed
207221
*/
208222
public function getTypeSelectHtml()
@@ -224,6 +238,8 @@ public function getTypeSelectHtml()
224238
}
225239

226240
/**
241+
* Get Require Select Html
242+
*
227243
* @return mixed
228244
*/
229245
public function getRequireSelectHtml()
@@ -272,10 +288,13 @@ public function getTemplatesHtml()
272288
}
273289

274290
/**
291+
* Get Option Values
292+
*
275293
* @return \Magento\Framework\DataObject[]
276294
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
277295
* @SuppressWarnings(PHPMD.NPathComplexity)
278296
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
297+
* phpcs:disable Generic.Metrics.NestingLevel
279298
*/
280299
public function getOptionValues()
281300
{
@@ -307,7 +326,7 @@ public function getOptionValues()
307326
$value['sort_order'] = $option->getSortOrder();
308327
$value['can_edit_price'] = $this->getCanEditPrice();
309328

310-
if ($this->getProduct()->getStoreId() != '0') {
329+
if ($this->getProduct()->getStoreId() != \Magento\Store\Model\Store::DEFAULT_STORE_ID) {
311330
$value['checkboxScopeTitle'] = $this->getCheckboxScopeHtml(
312331
$option->getOptionId(),
313332
'title',
@@ -335,7 +354,7 @@ public function getOptionValues()
335354
'sort_order' => $_value->getSortOrder(),
336355
];
337356

338-
if ($this->getProduct()->getStoreId() != '0') {
357+
if ($this->getProduct()->getStoreId() != \Magento\Store\Model\Store::DEFAULT_STORE_ID) {
339358
$value['optionValues'][$i]['checkboxScopeTitle'] = $this->getCheckboxScopeHtml(
340359
$_value->getOptionId(),
341360
'title',
@@ -371,7 +390,7 @@ public function getOptionValues()
371390
$value['file_extension'] = $option->getFileExtension();
372391
$value['image_size_x'] = $option->getImageSizeX();
373392
$value['image_size_y'] = $option->getImageSizeY();
374-
if ($this->getProduct()->getStoreId() != '0'
393+
if ($this->getProduct()->getStoreId() != \Magento\Store\Model\Store::DEFAULT_STORE_ID
375394
&& $scope == \Magento\Store\Model\Store::PRICE_SCOPE_WEBSITE
376395
) {
377396
$value['checkboxScopePrice'] = $this->getCheckboxScopeHtml(
@@ -431,6 +450,8 @@ public function getCheckboxScopeHtml($id, $name, $checked = true, $select_id = '
431450
}
432451

433452
/**
453+
* Get Price Value
454+
*
434455
* @param float $value
435456
* @param string $type
436457
* @return string

0 commit comments

Comments
 (0)