Skip to content

Commit ada5457

Browse files
🔃 [EngCom] Public Pull Requests - 2.2-develop
Accepted Public Pull Requests: - #16766: fix #16764 Rating Star issue on Product detail Page. (by @Karlasa) - #16748: Remove commented code & remove space (by @ronak2ram) - #14379: [Backport 2.2] Issue 14351: Product import doesn't change `Enable Qty Increments` field (by @simpleadm) - #16599: Fixed backwards incompatible change to Transport variable event parameters (by @gwharton) - #13569: Correctly save Product Custom Option values (by @JeroenVanLeusden) Fixed GitHub Issues: - #16764: Rating Star issue on Product detail Page. (reported by @Sathishkumar8731) has been fixed in #16766 by @Karlasa in 2.2-develop branch Related commits: 1. dd6b78a - #14351: Product import doesn't change `Enable Qty Increments` field (reported by @simpleadm) has been fixed in #14379 by @simpleadm in 2.2-develop branch Related commits: 1. 54507a7 2. 637979f - #10210: Transport variable can not be altered in email_invoice_set_template_vars_before Event (reported by @diybook) has been fixed in #16599 by @gwharton in 2.2-develop branch Related commits: 1. 61b868f - #5067: Custom option values do not save correctly (reported by @samtay) has been fixed in #13569 by @JeroenVanLeusden in 2.2-develop branch Related commits: 1. d7f6baa 2. cb304db 3. 0b3fd22
2 parents 07bd6e5 + 930f78e commit ada5457

File tree

8 files changed

+42
-29
lines changed

8 files changed

+42
-29
lines changed

app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Datetime.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ public function getValue($index = null)
2626
{
2727
if ($index) {
2828
if ($data = $this->getData('value', 'orig_' . $index)) {
29-
// date('Y-m-d', strtotime($data));
3029
return $data;
3130
}
3231
return null;
@@ -154,7 +153,7 @@ public function getEscapedValue($index = null)
154153
if (is_string($value)) {
155154
return $this->escapeHtml($value);
156155
}
157-
156+
158157
return $value;
159158
}
160159

app/code/Magento/Backend/Block/Widget/Grid/Massaction/AbstractMassaction.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,13 +276,13 @@ public function getGridIdsJson()
276276
}
277277
/** @var \Magento\Framework\Data\Collection $allIdsCollection */
278278
$allIdsCollection = clone $this->getParentBlock()->getCollection();
279-
279+
280280
if ($this->getMassactionIdField()) {
281281
$massActionIdField = $this->getMassactionIdField();
282282
} else {
283283
$massActionIdField = $this->getParentBlock()->getMassactionIdField();
284284
}
285-
285+
286286
$gridIds = $allIdsCollection->setPageSize(0)->getColumnValues($massActionIdField);
287287
if (!empty($gridIds)) {
288288
return join(",", $gridIds);

app/code/Magento/Backend/Block/Widget/Grid/Massaction/Extended.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,13 +273,13 @@ public function getGridIdsJson()
273273

274274
/** @var \Magento\Framework\Data\Collection $allIdsCollection */
275275
$allIdsCollection = clone $this->getParentBlock()->getCollection();
276-
276+
277277
if ($this->getMassactionIdField()) {
278278
$massActionIdField = $this->getMassactionIdField();
279279
} else {
280280
$massActionIdField = $this->getParentBlock()->getMassactionIdField();
281281
}
282-
282+
283283
$gridIds = $allIdsCollection->setPageSize(0)->getColumnValues($massActionIdField);
284284

285285
if (!empty($gridIds)) {

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

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
use Magento\Catalog\Api\Data\ProductCustomOptionInterface;
1010
use Magento\Catalog\Api\Data\ProductCustomOptionValuesInterface;
11+
use Magento\Catalog\Api\Data\ProductCustomOptionValuesInterfaceFactory;
1112
use Magento\Catalog\Api\Data\ProductInterface;
1213
use Magento\Catalog\Model\Product;
1314
use Magento\Catalog\Model\ResourceModel\Product\Option\Value\Collection;
@@ -102,6 +103,11 @@ class Option extends AbstractExtensibleModel implements ProductCustomOptionInter
102103
*/
103104
private $metadataPool;
104105

106+
/**
107+
* @var ProductCustomOptionValuesInterfaceFactory
108+
*/
109+
private $customOptionValuesFactory;
110+
105111
/**
106112
* @param \Magento\Framework\Model\Context $context
107113
* @param \Magento\Framework\Registry $registry
@@ -114,6 +120,7 @@ class Option extends AbstractExtensibleModel implements ProductCustomOptionInter
114120
* @param \Magento\Framework\Model\ResourceModel\AbstractResource $resource
115121
* @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection
116122
* @param array $data
123+
* @param ProductCustomOptionValuesInterfaceFactory|null $customOptionValuesFactory
117124
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
118125
*/
119126
public function __construct(
@@ -127,12 +134,16 @@ public function __construct(
127134
Option\Validator\Pool $validatorPool,
128135
\Magento\Framework\Model\ResourceModel\AbstractResource $resource = null,
129136
\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
130-
array $data = []
137+
array $data = [],
138+
ProductCustomOptionValuesInterfaceFactory $customOptionValuesFactory = null
131139
) {
132140
$this->productOptionValue = $productOptionValue;
133141
$this->optionTypeFactory = $optionFactory;
134142
$this->validatorPool = $validatorPool;
135143
$this->string = $string;
144+
$this->customOptionValuesFactory = $customOptionValuesFactory ?:
145+
\Magento\Framework\App\ObjectManager::getInstance()->get(ProductCustomOptionValuesInterfaceFactory::class);
146+
136147
parent::__construct(
137148
$context,
138149
$registry,
@@ -391,20 +402,21 @@ public function beforeSave()
391402
*/
392403
public function afterSave()
393404
{
394-
$this->getValueInstance()->unsetValues();
395405
$values = $this->getValues() ?: $this->getData('values');
396406
if (is_array($values)) {
397407
foreach ($values as $value) {
398-
if ($value instanceof \Magento\Catalog\Api\Data\ProductCustomOptionValuesInterface) {
408+
if ($value instanceof ProductCustomOptionValuesInterface) {
399409
$data = $value->getData();
400410
} else {
401411
$data = $value;
402412
}
403-
$this->getValueInstance()->addValue($data);
404-
}
405413

406-
$this->getValueInstance()->setOption($this)->saveValues();
407-
} elseif ($this->getGroupByType($this->getType()) == self::OPTION_GROUP_SELECT) {
414+
$this->customOptionValuesFactory->create()
415+
->addValue($data)
416+
->setOption($this)
417+
->saveValues();
418+
}
419+
} elseif ($this->getGroupByType($this->getType()) === self::OPTION_GROUP_SELECT) {
408420
throw new LocalizedException(__('Select type options required values rows.'));
409421
}
410422

@@ -805,7 +817,7 @@ public function setImageSizeY($imageSizeY)
805817
}
806818

807819
/**
808-
* @param \Magento\Catalog\Api\Data\ProductCustomOptionValuesInterface[] $values
820+
* @param ProductCustomOptionValuesInterface[] $values
809821
* @return $this
810822
*/
811823
public function setValues(array $values = null)

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

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ class Value extends AbstractModel implements \Magento\Catalog\Api\Data\ProductCu
7878
* @param \Magento\Framework\Model\ResourceModel\AbstractResource $resource
7979
* @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection
8080
* @param array $data
81+
* @param CustomOptionPriceCalculator|null $customOptionPriceCalculator
8182
*/
8283
public function __construct(
8384
\Magento\Framework\Model\Context $context,
@@ -91,6 +92,7 @@ public function __construct(
9192
$this->_valueCollectionFactory = $valueCollectionFactory;
9293
$this->customOptionPriceCalculator = $customOptionPriceCalculator
9394
?? \Magento\Framework\App\ObjectManager::getInstance()->get(CustomOptionPriceCalculator::class);
95+
9496
parent::__construct(
9597
$context,
9698
$registry,
@@ -203,19 +205,15 @@ public function getProduct()
203205
*/
204206
public function saveValues()
205207
{
208+
$option = $this->getOption();
209+
206210
foreach ($this->getValues() as $value) {
207211
$this->isDeleted(false);
208-
$this->setData(
209-
$value
210-
)->setData(
211-
'option_id',
212-
$this->getOption()->getId()
213-
)->setData(
214-
'store_id',
215-
$this->getOption()->getStoreId()
216-
);
217-
218-
if ($this->getData('is_delete') == '1') {
212+
$this->setData($value)
213+
->setData('option_id', $option->getId())
214+
->setData('store_id', $option->getStoreId());
215+
216+
if ((bool) $this->getData('is_delete') === true) {
219217
if ($this->getId()) {
220218
$this->deleteValues($this->getId());
221219
$this->delete();
@@ -224,7 +222,7 @@ public function saveValues()
224222
$this->save();
225223
}
226224
}
227-
//eof foreach()
225+
228226
return $this;
229227
}
230228

app/code/Magento/CatalogImportExport/Model/Import/Product.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Magento\Catalog\Model\Product\Visibility;
1010
use Magento\CatalogImportExport\Model\Import\Product\MediaGalleryProcessor;
1111
use Magento\CatalogImportExport\Model\Import\Product\RowValidatorInterface as ValidatorInterface;
12+
use Magento\CatalogInventory\Api\Data\StockItemInterface;
1213
use Magento\Framework\App\Filesystem\DirectoryList;
1314
use Magento\Framework\Exception\LocalizedException;
1415
use Magento\Framework\Filesystem;
@@ -2580,7 +2581,10 @@ private function _setStockUseConfigFieldsValues($rowData)
25802581
{
25812582
$useConfigFields = [];
25822583
foreach ($rowData as $key => $value) {
2583-
$useConfigName = self::INVENTORY_USE_CONFIG_PREFIX . $key;
2584+
$useConfigName = $key === StockItemInterface::ENABLE_QTY_INCREMENTS
2585+
? StockItemInterface::USE_CONFIG_ENABLE_QTY_INC
2586+
: self::INVENTORY_USE_CONFIG_PREFIX . $key;
2587+
25842588
if (isset($this->defaultStockData[$key])
25852589
&& isset($this->defaultStockData[$useConfigName])
25862590
&& !empty($value)

app/code/Magento/Sales/Model/Order/Email/Sender/OrderSender.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ protected function prepareTemplate(Order $order)
138138
*/
139139
$this->eventManager->dispatch(
140140
'email_order_set_template_vars_before',
141-
['sender' => $this, 'transport' => $transportObject->getData(), 'transportObject' => $transportObject]
141+
['sender' => $this, 'transport' => $transportObject, 'transportObject' => $transportObject]
142142
);
143143

144144
$this->templateContainer->setTemplateVars($transportObject->getData());

lib/web/css/source/lib/_rating.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
input[type="radio"] {
3939
.lib-visually-hidden();
4040

41-
&:focus,
41+
&:hover,
4242
&:checked {
4343
+ label {
4444
&:before {

0 commit comments

Comments
 (0)