Skip to content

Commit 48f1e41

Browse files
authored
Merge pull request #2943 from magento-mpi/port-2572
[MPI] Forwardport #2572
2 parents 8c227d5 + 204c99b commit 48f1e41

File tree

6 files changed

+126
-24
lines changed

6 files changed

+126
-24
lines changed

app/code/Magento/ConfigurableProduct/Setup/Patch/Data/InstallInitialConfigurableAttributes.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ public function apply()
5151
$eavSetup = $this->eavSetupFactory->create(['setup' => $this->moduleDataSetup]);
5252
$attributes = [
5353
'country_of_manufacture',
54+
'manufacturer',
5455
'minimal_price',
5556
'msrp',
5657
'msrp_display_actual_price_type',
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\ConfigurableProduct\Setup\Patch\Data;
9+
10+
use Magento\Eav\Setup\EavSetup;
11+
use Magento\Eav\Setup\EavSetupFactory;
12+
use Magento\Framework\Setup\ModuleDataSetupInterface;
13+
use Magento\Framework\Setup\Patch\DataPatchInterface;
14+
use Magento\Framework\Setup\Patch\PatchVersionInterface;
15+
use Magento\ConfigurableProduct\Model\Product\Type\Configurable;
16+
17+
/**
18+
* Class UpdateManufacturerAttribute
19+
* @package Magento\ConfigurableProduct\Setup\Patch
20+
*/
21+
class UpdateManufacturerAttribute implements DataPatchInterface, PatchVersionInterface
22+
{
23+
/**
24+
* @var ModuleDataSetupInterface
25+
*/
26+
private $moduleDataSetup;
27+
28+
/**
29+
* @var EavSetupFactory
30+
*/
31+
private $eavSetupFactory;
32+
33+
/**
34+
* UpdateTierPriceAttribute constructor.
35+
* @param ModuleDataSetupInterface $moduleDataSetup
36+
* @param EavSetupFactory $eavSetupFactory
37+
*/
38+
public function __construct(
39+
ModuleDataSetupInterface $moduleDataSetup,
40+
EavSetupFactory $eavSetupFactory
41+
) {
42+
$this->moduleDataSetup = $moduleDataSetup;
43+
$this->eavSetupFactory = $eavSetupFactory;
44+
}
45+
46+
/**
47+
* {@inheritdoc}
48+
*/
49+
public function apply()
50+
{
51+
/** @var EavSetup $eavSetup */
52+
$eavSetup = $this->eavSetupFactory->create(['setup' => $this->moduleDataSetup]);
53+
$relatedProductTypes = explode(
54+
',',
55+
$eavSetup->getAttribute(\Magento\Catalog\Model\Product::ENTITY, 'manufacturer', 'apply_to')
56+
);
57+
58+
if (!in_array(Configurable::TYPE_CODE, $relatedProductTypes)) {
59+
$relatedProductTypes[] = Configurable::TYPE_CODE;
60+
$eavSetup->updateAttribute(
61+
\Magento\Catalog\Model\Product::ENTITY,
62+
'manufacturer',
63+
'apply_to',
64+
implode(',', $relatedProductTypes)
65+
);
66+
}
67+
}
68+
69+
/**
70+
* {@inheritdoc}
71+
*/
72+
public static function getDependencies()
73+
{
74+
return [
75+
InstallInitialConfigurableAttributes::class,
76+
];
77+
}
78+
79+
/**
80+
* {@inheritdoc}\
81+
*/
82+
public static function getVersion()
83+
{
84+
return '2.2.1';
85+
}
86+
87+
/**
88+
* {@inheritdoc}
89+
*/
90+
public function getAliases()
91+
{
92+
return [];
93+
}
94+
}

app/code/Magento/Review/Block/Customer/ListCustomer.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,13 +154,13 @@ public function getProductLink()
154154
/**
155155
* Get product URL
156156
*
157-
* @param \Magento\Review\Model\Review $review
157+
* @param \Magento\Catalog\Model\Product $product
158158
* @return string
159159
* @since 100.2.0
160160
*/
161-
public function getProductUrl($review)
161+
public function getProductUrl($product)
162162
{
163-
return $this->getUrl('catalog/product/view', ['id' => $review->getEntityPkValue()]);
163+
return $product->getProductUrl();
164164
}
165165

166166
/**

app/code/Magento/Review/view/frontend/templates/customer/list.phtml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,29 +22,29 @@
2222
</tr>
2323
</thead>
2424
<tbody>
25-
<?php foreach ($block->getReviews() as $_review): ?>
25+
<?php foreach ($block->getReviews() as $review): ?>
2626
<tr>
27-
<td data-th="<?= $block->escapeHtml(__('Created')) ?>" class="col date"><?= $block->escapeHtml($block->dateFormat($_review->getReviewCreatedAt())) ?></td>
27+
<td data-th="<?= $block->escapeHtml(__('Created')) ?>" class="col date"><?= $block->escapeHtml($block->dateFormat($review->getReviewCreatedAt())) ?></td>
2828
<td data-th="<?= $block->escapeHtml(__('Product Name')) ?>" class="col item">
2929
<strong class="product-name">
30-
<a href="<?= $block->escapeUrl($block->getProductUrl($_review)) ?>"><?= $block->escapeHtml($_review->getName()) ?></a>
30+
<a href="<?= $block->escapeUrl($block->getProductUrl($review)) ?>"><?= $block->escapeHtml($review->getName()) ?></a>
3131
</strong>
3232
</td>
3333
<td data-th="<?= $block->escapeHtml(__('Rating')) ?>" class="col summary">
34-
<?php if ($_review->getSum()): ?>
34+
<?php if ($review->getSum()): ?>
3535
<div class="rating-summary">
3636
<span class="label"><span><?= $block->escapeHtml(__('Rating')) ?>:</span></span>
37-
<div class="rating-result" title="<?= /* @noEscape */ ((int)$_review->getSum() / (int)$_review->getCount()) ?>%">
38-
<span style="width:<?= /* @noEscape */ ((int)$_review->getSum() / (int)$_review->getCount()) ?>%;"><span><?= /* @noEscape */ ((int)$_review->getSum() / (int)$_review->getCount()) ?>%</span></span>
37+
<div class="rating-result" title="<?= /* @noEscape */ ((int)$review->getSum() / (int)$review->getCount()) ?>%">
38+
<span style="width:<?= /* @noEscape */ ((int)$review->getSum() / (int)$review->getCount()) ?>%;"><span><?= /* @noEscape */ ((int)$review->getSum() / (int)$review->getCount()) ?>%</span></span>
3939
</div>
4040
</div>
4141
<?php endif; ?>
4242
</td>
4343
<td data-th="<?= $block->escapeHtmlAttr(__('Review')) ?>" class="col description">
44-
<?= $this->helper('Magento\Review\Helper\Data')->getDetailHtml($_review->getDetail()) ?>
44+
<?= $this->helper('Magento\Review\Helper\Data')->getDetailHtml($review->getDetail()) ?>
4545
</td>
4646
<td data-th="<?= $block->escapeHtmlAttr(__('Actions')) ?>" class="col actions">
47-
<a href="<?= $block->escapeUrl($block->getReviewUrl($_review)) ?>" class="action more">
47+
<a href="<?= $block->escapeUrl($block->getReviewUrl($review)) ?>" class="action more">
4848
<span><?= $block->escapeHtml(__('See Details')) ?></span>
4949
</a>
5050
</td>

app/code/Magento/Ui/view/base/web/templates/form/components/collection/preview.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
'company',
1212
'street',
1313
{
14-
items: 'city region_id postcode',
14+
items: 'city region_id region_id_input postcode',
1515
separator: ', '
1616
},
1717
'country_id',

lib/web/magnifier/magnify.js

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,6 @@ define([
277277

278278
settings = $.extend(dimentions, {
279279
top: top,
280-
bottom: bottom,
281280
left: left,
282281
right: right
283282
});
@@ -557,6 +556,16 @@ define([
557556
trailing: false
558557
});
559558

559+
/**
560+
* Returns top position value for passed jQuery object.
561+
*
562+
* @param $el
563+
* @return {number}
564+
*/
565+
function getTop($el) {
566+
return parseInt($el.get(0).style.top);
567+
}
568+
560569
function shiftImage(dx, dy, e) {
561570
var top = +imagePosY + dy,
562571
left = +imagePosX + dx,
@@ -584,16 +593,13 @@ define([
584593
}
585594

586595
if ($image.height() > $imageContainer.height()) {
587-
588-
if ($imageContainer.offset().top + $imageContainer.height() > top + $image.height()) {
589-
top = $imageContainer.offset().top + $imageContainer.height() - $image.height();
596+
if ($imageContainer.height() > $image.height() + top) {
597+
$image.css('top', $imageContainer.height() - $image.height());
590598
} else {
591-
top = $imageContainer.offset().top < top ? 0 : top;
599+
top = $image.height() - getTop($image) - $imageContainer.height();
600+
dy = dy < top ? dy : top;
601+
$image.css('top', getTop($image) + dy);
592602
}
593-
$image.offset({
594-
'top': top
595-
});
596-
$image.css('bottom', '');
597603
}
598604

599605
if ($image.width() > $imageContainer.width()) {
@@ -690,7 +696,7 @@ define([
690696
} else if (gallery.fullScreen && (!transitionEnabled || !transitionActive)) {
691697
e.preventDefault();
692698

693-
imagePosY = $image.offset().top;
699+
imagePosY = getTop($image);
694700
imagePosX = $image.offset().left;
695701

696702
if (isTouchEnabled) {
@@ -746,6 +752,7 @@ define([
746752
}
747753

748754
if (allowZoomOut) {
755+
imagePosY = getTop($(fullscreenImageSelector, $gallery));
749756
shiftImage(clientX - startX, clientY - startY, e);
750757
}
751758
}
@@ -771,13 +778,13 @@ define([
771778
isFullScreen = $(gallerySelector).data('fotorama').fullScreen,
772779
initVars = function () {
773780
imagePosX = $(fullscreenImageSelector, $gallery).offset().left;
774-
imagePosY = $(fullscreenImageSelector, $gallery).offset().top;
781+
imagePosY = getTop($(fullscreenImageSelector, $gallery));
775782
};
776783

777784
if (($focus.attr('data-gallery-role') || !$focus.length) && allowZoomOut) {
778785
if (isFullScreen) {
779786
imagePosX = $(fullscreenImageSelector, $(gallerySelector)).offset().left;
780-
imagePosY = $(fullscreenImageSelector, $(gallerySelector)).offset().top;
787+
imagePosY = getTop($(fullscreenImageSelector, $(gallerySelector)));
781788
}
782789

783790
if (e.keyCode === 39) {

0 commit comments

Comments
 (0)