Skip to content

Commit 3e2e613

Browse files
committed
Merge branch 'port-2572' into port-2618
2 parents 380e29d + eefd0a5 commit 3e2e613

File tree

4 files changed

+115
-13
lines changed

4 files changed

+115
-13
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+
$key = array_search(Configurable::TYPE_CODE, $relatedProductTypes);
58+
if ($key !== false) {
59+
unset($relatedProductTypes[$key]);
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/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)