Skip to content

Commit 988a826

Browse files
committed
Merge remote-tracking branch 'origin/MAGETWO-72841' into 2.3-develop-pr19
2 parents dbfdf02 + 8cab441 commit 988a826

File tree

28 files changed

+394
-72
lines changed

28 files changed

+394
-72
lines changed

app/code/Magento/Catalog/Model/Indexer/Product/Eav/AbstractAction.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
*/
66
namespace Magento\Catalog\Model\Indexer\Product\Eav;
77

8+
use Magento\Catalog\Model\ResourceModel\Product\Indexer\Eav\AbstractEav;
9+
810
/**
911
* Abstract action reindex class
1012
*/
@@ -51,7 +53,7 @@ abstract public function execute($ids);
5153
/**
5254
* Retrieve array of EAV type indexers
5355
*
54-
* @return \Magento\Catalog\Model\ResourceModel\Product\Indexer\Eav\AbstractEav[]
56+
* @return AbstractEav[]
5557
*/
5658
public function getIndexers()
5759
{
@@ -69,7 +71,7 @@ public function getIndexers()
6971
* Retrieve indexer instance by type
7072
*
7173
* @param string $type
72-
* @return \Magento\Catalog\Model\ResourceModel\Product\Indexer\Eav\AbstractEav
74+
* @return AbstractEav
7375
* @throws \Magento\Framework\Exception\LocalizedException
7476
*/
7577
public function getIndexer($type)
@@ -108,7 +110,7 @@ public function reindex($ids = null)
108110
/**
109111
* Synchronize data between index storage and original storage
110112
*
111-
* @param \Magento\Catalog\Model\ResourceModel\Product\Indexer\Eav\AbstractEav $indexer
113+
* @param AbstractEav $indexer
112114
* @param string $destinationTable
113115
* @param array $ids
114116
* @throws \Exception
@@ -134,16 +136,17 @@ protected function syncData($indexer, $destinationTable, $ids)
134136
/**
135137
* Retrieve product relations by children and parent
136138
*
137-
* @param \Magento\Catalog\Model\ResourceModel\Product\Indexer\Eav\AbstractEav $indexer
139+
* @param AbstractEav $indexer
138140
* @param array $ids
139-
*
140141
* @param bool $onlyParents
141142
* @return array $ids
142143
*/
143-
protected function processRelations($indexer, $ids, $onlyParents = false)
144+
protected function processRelations(AbstractEav $indexer, array $ids, bool $onlyParents = false)
144145
{
145146
$parentIds = $indexer->getRelationsByChild($ids);
147+
$parentIds = array_unique(array_merge($parentIds, $ids));
146148
$childIds = $onlyParents ? [] : $indexer->getRelationsByParent($parentIds);
149+
147150
return array_unique(array_merge($ids, $childIds, $parentIds));
148151
}
149152
}

app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Eav/AbstractEav.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ public function reindexEntities($processIds)
8282
$this->_prepareIndex($processIds);
8383
$this->_prepareRelationIndex($processIds);
8484
$this->_removeNotVisibleEntityFromIndex();
85+
8586
return $this;
8687
}
8788

@@ -159,11 +160,12 @@ protected function _removeNotVisibleEntityFromIndex()
159160
* @param array $parentIds the parent entity ids limitation
160161
* @return \Magento\Framework\DB\Select
161162
*/
162-
protected function _prepareRelationIndexSelect($parentIds = null)
163+
protected function _prepareRelationIndexSelect(array $parentIds = null)
163164
{
164165
$connection = $this->getConnection();
165166
$idxTable = $this->getIdxTable();
166167
$linkField = $this->getMetadataPool()->getMetadata(ProductInterface::class)->getLinkField();
168+
167169
$select = $connection->select()->from(
168170
['l' => $this->getTable('catalog_product_relation')],
169171
[]
@@ -179,6 +181,14 @@ protected function _prepareRelationIndexSelect($parentIds = null)
179181
['i' => $idxTable],
180182
'l.child_id = i.entity_id AND cs.store_id = i.store_id',
181183
[]
184+
)->join(
185+
['sw' => $this->getTable('store_website')],
186+
"cs.website_id = sw.website_id",
187+
[]
188+
)->join(
189+
['cpw' => $this->getTable('catalog_product_website')],
190+
'i.entity_id = cpw.product_id AND sw.website_id = cpw.website_id',
191+
[]
182192
)->group(
183193
['parent_id', 'i.attribute_id', 'i.store_id', 'i.value', 'l.child_id']
184194
)->columns(

app/code/Magento/Catalog/Test/Unit/Model/Indexer/Product/Eav/AbstractActionTest.php

Lines changed: 43 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,20 @@ public function testReindexWithoutArgumentsExecutesReindexAll()
113113
$this->_model->reindex();
114114
}
115115

116-
public function testReindexWithNotNullArgumentExecutesReindexEntities()
117-
{
118-
$childIds = [1, 2, 3];
119-
$parentIds = [4];
120-
$reindexIds = array_merge($childIds, $parentIds);
116+
/**
117+
* @param array $ids
118+
* @param array $parentIds
119+
* @param array $childIds
120+
* @return void
121+
* @dataProvider reindexEntitiesDataProvider
122+
*/
123+
public function testReindexWithNotNullArgumentExecutesReindexEntities(
124+
array $ids,
125+
array $parentIds,
126+
array $childIds
127+
) : void {
128+
$reindexIds = array_unique(array_merge($ids, $parentIds, $childIds));
129+
121130
$connectionMock = $this->getMockBuilder(\Magento\Framework\DB\Adapter\AdapterInterface::class)
122131
->getMockForAbstractClass();
123132

@@ -129,11 +138,23 @@ public function testReindexWithNotNullArgumentExecutesReindexEntities()
129138
->disableOriginalConstructor()
130139
->getMock();
131140

132-
$eavSource->expects($this->once())->method('getRelationsByChild')->with($childIds)->willReturn($childIds);
133-
$eavSource->expects($this->once())->method('getRelationsByParent')->with($childIds)->willReturn($parentIds);
141+
$eavSource->expects($this->once())
142+
->method('getRelationsByChild')
143+
->with($ids)
144+
->willReturn($parentIds);
145+
$eavSource->expects($this->once())
146+
->method('getRelationsByParent')
147+
->with(array_unique(array_merge($parentIds, $ids)))
148+
->willReturn($childIds);
134149

135-
$eavDecimal->expects($this->once())->method('getRelationsByChild')->with($reindexIds)->willReturn($reindexIds);
136-
$eavDecimal->expects($this->once())->method('getRelationsByParent')->with($reindexIds)->willReturn([]);
150+
$eavDecimal->expects($this->once())
151+
->method('getRelationsByChild')
152+
->with($reindexIds)
153+
->willReturn($parentIds);
154+
$eavDecimal->expects($this->once())
155+
->method('getRelationsByParent')
156+
->with(array_unique(array_merge($parentIds, $reindexIds)))
157+
->willReturn($childIds);
137158

138159
$eavSource->expects($this->once())->method('getConnection')->willReturn($connectionMock);
139160
$eavDecimal->expects($this->once())->method('getConnection')->willReturn($connectionMock);
@@ -153,6 +174,18 @@ public function testReindexWithNotNullArgumentExecutesReindexEntities()
153174
->method('create')
154175
->will($this->returnValue($eavDecimal));
155176

156-
$this->_model->reindex($childIds);
177+
$this->_model->reindex($ids);
178+
}
179+
180+
/**
181+
* @return array
182+
*/
183+
public function reindexEntitiesDataProvider() : array
184+
{
185+
return [
186+
[[4], [], [1, 2, 3]],
187+
[[3], [4], []],
188+
[[5], [], []],
189+
];
157190
}
158191
}

app/code/Magento/Catalog/view/base/web/js/price-options.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ define([
2020
optionConfig: {},
2121
optionHandlers: {},
2222
optionTemplate: '<%= data.label %>' +
23-
'<% if (data.finalPrice.value) { %>' +
23+
'<% if (data.finalPrice.value > 0) { %>' +
2424
' +<%- data.finalPrice.formatted %>' +
25+
'<% } else if (data.finalPrice.value < 0) { %>' +
26+
' <%- data.finalPrice.formatted %>' +
2527
'<% } %>',
2628
controlContainer: 'dd'
2729
};

app/code/Magento/Catalog/view/frontend/templates/product/compare/list.phtml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
?>
1111
<?php $_total = $block->getItems()->getSize() ?>
1212
<?php if ($_total): ?>
13-
<a href="#" class="action print" title="<?= /* @escapeNotVerified */ __('Print This Page') ?>">
13+
<a href="#" class="action print hidden-print" title="<?= /* @escapeNotVerified */ __('Print This Page') ?>">
1414
<span><?= /* @escapeNotVerified */ __('Print This Page') ?></span>
1515
</a>
1616
<div class="table-wrapper comparison">
@@ -29,7 +29,7 @@
2929
<?php if ($_i++ == 0): ?>
3030
<th scope="row" class="cell label remove"><span><?= /* @escapeNotVerified */ __('Remove Product') ?></span></th>
3131
<?php endif; ?>
32-
<td class="cell remove product">
32+
<td class="cell remove product hidden-print">
3333
<?php $compareHelper = $this->helper('Magento\Catalog\Helper\Product\Compare');?>
3434
<a href="#" data-post='<?= /* @escapeNotVerified */ $compareHelper->getPostDataRemove($_item) ?>'
3535
class="action delete" title="<?= /* @escapeNotVerified */ __('Remove Product') ?>">
@@ -59,7 +59,7 @@
5959
</strong>
6060
<?= $block->getReviewsSummaryHtml($_item, 'short') ?>
6161
<?= /* @escapeNotVerified */ $block->getProductPrice($_item, '-compare-list-top') ?>
62-
<div class="product-item-actions">
62+
<div class="product-item-actions hidden-print">
6363
<div class="actions-primary">
6464
<?php if ($_item->isSaleable()): ?>
6565
<form data-role="tocart-form" action="<?= /* @escapeNotVerified */ $this->helper('Magento\Catalog\Helper\Product\Compare')->getAddToCartUrl($_item) ?>" method="post">

app/code/Magento/Customer/Model/Customer/NotificationStorage.php

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66
namespace Magento\Customer\Model\Customer;
77

8+
use Magento\Framework\App\ObjectManager;
89
use Magento\Framework\Cache\FrontendInterface;
910
use Magento\Framework\Serialize\SerializerInterface;
1011

@@ -18,21 +19,21 @@ class NotificationStorage
1819
private $cache;
1920

2021
/**
21-
* @param FrontendInterface $cache
22-
*/
23-
24-
/**
25-
* @param FrontendInterface $cache
22+
* @var SerializerInterface
2623
*/
2724
private $serializer;
2825

2926
/**
3027
* NotificationStorage constructor.
3128
* @param FrontendInterface $cache
29+
* @param SerializerInterface $serializer
3230
*/
33-
public function __construct(FrontendInterface $cache)
34-
{
31+
public function __construct(
32+
FrontendInterface $cache,
33+
SerializerInterface $serializer = null
34+
) {
3535
$this->cache = $cache;
36+
$this->serializer = $serializer ?: ObjectManager::getInstance()->get(SerializerInterface::class);
3637
}
3738

3839
/**
@@ -45,7 +46,7 @@ public function __construct(FrontendInterface $cache)
4546
public function add($notificationType, $customerId)
4647
{
4748
$this->cache->save(
48-
$this->getSerializer()->serialize([
49+
$this->serializer->serialize([
4950
'customer_id' => $customerId,
5051
'notification_type' => $notificationType
5152
]),
@@ -88,19 +89,4 @@ private function getCacheKey($notificationType, $customerId)
8889
{
8990
return 'notification_' . $notificationType . '_' . $customerId;
9091
}
91-
92-
/**
93-
* Get serializer
94-
*
95-
* @return SerializerInterface
96-
* @deprecated 100.2.0
97-
*/
98-
private function getSerializer()
99-
{
100-
if ($this->serializer === null) {
101-
$this->serializer = \Magento\Framework\App\ObjectManager::getInstance()
102-
->get(SerializerInterface::class);
103-
}
104-
return $this->serializer;
105-
}
10692
}

app/code/Magento/Eav/Model/Entity/Attribute/Frontend/AbstractFrontend.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ public function getValue(\Magento\Framework\DataObject $object)
165165
$options = $opt->getAllOptions();
166166
if ($options) {
167167
foreach ($options as $option) {
168-
if ($option['value'] == $value) {
168+
if ($option['value'] === $value) {
169169
$valueOption = $option['label'];
170170
}
171171
}

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,14 +131,17 @@ protected function prepareTemplate(Order $order)
131131
'formattedShippingAddress' => $this->getFormattedShippingAddress($order),
132132
'formattedBillingAddress' => $this->getFormattedBillingAddress($order),
133133
];
134-
$transport = new DataObject($transport);
134+
$transportObject = new DataObject($transport);
135135

136+
/**
137+
* Event argument `transport` is @deprecated. Use `transportObject` instead.
138+
*/
136139
$this->eventManager->dispatch(
137140
'email_order_set_template_vars_before',
138-
['sender' => $this, 'transport' => $transport]
141+
['sender' => $this, 'transport' => $transportObject->getData(), 'transportObject' => $transportObject]
139142
);
140143

141-
$this->templateContainer->setTemplateVars($transport->getData());
144+
$this->templateContainer->setTemplateVars($transportObject->getData());
142145

143146
parent::prepareTemplate($order);
144147
}

app/design/frontend/Magento/blank/Magento_Checkout/web/css/source/module/checkout/_tooltip.less

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
// _____________________________________________
99

1010
@checkout-tooltip__hover__z-index: @tooltip__z-index;
11-
@checkout-tooltip-breakpoint__screen-m: @modal-popup-breakpoint-screen__m;
1211

1312
@checkout-tooltip-icon-arrow__font-size: 10px;
1413
@checkout-tooltip-icon-arrow__left: -( @checkout-tooltip-content__padding + @checkout-tooltip-icon-arrow__font-size - @checkout-tooltip-content__border-width);
@@ -138,7 +137,7 @@
138137
}
139138
}
140139

141-
.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @checkout-tooltip-breakpoint__screen-m) {
140+
.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__m) {
142141
.field-tooltip {
143142
.field-tooltip-content {
144143
&:extend(.abs-checkout-tooltip-content-position-top-mobile all);

app/design/frontend/Magento/blank/Magento_Sales/web/css/source/_module.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@
262262
}
263263

264264
.toolbar {
265-
&:extend(.abs-add-clearfix-desktop all);
265+
&:extend(.abs-add-clearfix-mobile all);
266266

267267
.pages {
268268
float: right;

0 commit comments

Comments
 (0)