Skip to content

Commit bae6494

Browse files
committed
Merge branch 'catalog-image-resizing' into ECP-98
# Conflicts: # app/code/Magento/Catalog/Model/Product/Image.php
2 parents 5bb3448 + dae5284 commit bae6494

File tree

185 files changed

+4606
-889
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

185 files changed

+4606
-889
lines changed

app/code/Magento/Backend/Test/Mftf/Test/AdminLoginTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@
2424
<seeInCurrentUrl url="{{AdminLoginPage.url}}" stepKey="seeAdminLoginUrl"/>
2525
<actionGroup ref="logout" stepKey="logoutFromAdmin"/>
2626
</test>
27-
</tests>
27+
</tests>

app/code/Magento/Backend/view/adminhtml/web/js/translate.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ define([
3535
* @return {String}
3636
*/
3737
this.translate = function (text) {
38-
return _data[text] ? _data[text] : text;
38+
return typeof _data[text] === 'string' ? _data[text] : text;
3939
};
4040

4141
return this;

app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/paypal.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ define([
269269
*/
270270
onError: function () {
271271
self.showError($t('Payment ' + self.getTitle() + ' can\'t be initialized'));
272+
self.reInitPayPal();
272273
}
273274
}, self.paypalButtonSelector);
274275
},

app/code/Magento/CardinalCommerce/Test/Mftf/Test/AdminCardinalCommerceSettingsHiddenTest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
1010
<test name="AdminCardinalCommerceSettingsHiddenTest">
1111
<annotations>
12+
<stories value="Cardinal Commerce Settings"/>
1213
<features value="CardinalCommerce"/>
1314
<title value="CardinalCommerce settings hidden" />
1415
<description value="CardinalCommerce config shouldn't be visible if the 3D secure is disabled for Authorize.Net."/>

app/code/Magento/Catalog/Block/Ui/ProductViewCounter.php

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,17 @@
66
namespace Magento\Catalog\Block\Ui;
77

88
use Magento\Catalog\Api\Data\ProductInterface;
9+
use Magento\Catalog\Model\ProductRenderFactory;
10+
use Magento\Catalog\Model\ProductRepository;
911
use Magento\Catalog\Ui\DataProvider\Product\ProductRenderCollectorComposite;
12+
use Magento\Framework\App\Config\ScopeConfigInterface;
13+
use Magento\Framework\App\ObjectManager;
14+
use Magento\Framework\EntityManager\Hydrator;
1015
use Magento\Framework\Registry;
1116
use Magento\Framework\Serialize\SerializerInterface;
1217
use Magento\Framework\Url;
1318
use Magento\Framework\View\Element\Template;
1419
use Magento\Store\Model\Store;
15-
use Magento\Catalog\Model\ProductRenderFactory;
16-
use Magento\Catalog\Model\ProductRepository;
17-
use Magento\Framework\EntityManager\Hydrator;
1820
use Magento\Store\Model\StoreManager;
1921

2022
/**
@@ -25,6 +27,7 @@
2527
*
2628
* @api
2729
* @since 101.1.0
30+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2831
*/
2932
class ProductViewCounter extends Template
3033
{
@@ -68,6 +71,13 @@ class ProductViewCounter extends Template
6871
*/
6972
private $registry;
7073

74+
/**
75+
* Core store config
76+
*
77+
* @var ScopeConfigInterface
78+
*/
79+
private $scopeConfig;
80+
7181
/**
7282
* @param Template\Context $context
7383
* @param ProductRepository $productRepository
@@ -78,6 +88,8 @@ class ProductViewCounter extends Template
7888
* @param SerializerInterface $serialize
7989
* @param Url $url
8090
* @param Registry $registry
91+
* @param ScopeConfigInterface|null $scopeConfig
92+
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
8193
*/
8294
public function __construct(
8395
Template\Context $context,
@@ -88,7 +100,8 @@ public function __construct(
88100
Hydrator $hydrator,
89101
SerializerInterface $serialize,
90102
Url $url,
91-
Registry $registry
103+
Registry $registry,
104+
?ScopeConfigInterface $scopeConfig = null
92105
) {
93106
parent::__construct($context);
94107
$this->productRepository = $productRepository;
@@ -99,6 +112,7 @@ public function __construct(
99112
$this->serialize = $serialize;
100113
$this->url = $url;
101114
$this->registry = $registry;
115+
$this->scopeConfig = $scopeConfig ?? ObjectManager::getInstance()->get(ScopeConfigInterface::class);
102116
}
103117

104118
/**
@@ -116,14 +130,19 @@ public function getCurrentProductData()
116130
{
117131
/** @var ProductInterface $product */
118132
$product = $this->registry->registry('product');
133+
$productsScope = $this->scopeConfig->getValue(
134+
'catalog/recently_products/scope',
135+
\Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE
136+
);
119137
/** @var Store $store */
120138
$store = $this->storeManager->getStore();
121139

122140
if (!$product || !$product->getId()) {
123141
return $this->serialize->serialize([
124142
'items' => [],
125143
'store' => $store->getId(),
126-
'currency' => $store->getCurrentCurrency()->getCode()
144+
'currency' => $store->getCurrentCurrency()->getCode(),
145+
'productCurrentScope' => $productsScope
127146
]);
128147
}
129148

@@ -140,7 +159,8 @@ public function getCurrentProductData()
140159
$product->getId() => $data
141160
],
142161
'store' => $store->getId(),
143-
'currency' => $store->getCurrentCurrency()->getCode()
162+
'currency' => $store->getCurrentCurrency()->getCode(),
163+
'productCurrentScope' => $productsScope
144164
];
145165

146166
return $this->serialize->serialize($currentProductData);

app/code/Magento/Catalog/CustomerData/CompareProducts.php

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,13 @@
66
namespace Magento\Catalog\CustomerData;
77

88
use Magento\Customer\CustomerData\SectionSourceInterface;
9+
use Magento\Framework\App\Config\ScopeConfigInterface;
10+
use Magento\Framework\App\ObjectManager;
11+
use Magento\Framework\Exception\LocalizedException;
912

13+
/**
14+
* Catalog Product Compare Widget
15+
*/
1016
class CompareProducts implements SectionSourceInterface
1117
{
1218
/**
@@ -24,23 +30,33 @@ class CompareProducts implements SectionSourceInterface
2430
*/
2531
private $outputHelper;
2632

33+
/**
34+
* Core store config
35+
*
36+
* @var ScopeConfigInterface
37+
*/
38+
private $scopeConfig;
39+
2740
/**
2841
* @param \Magento\Catalog\Helper\Product\Compare $helper
2942
* @param \Magento\Catalog\Model\Product\Url $productUrl
3043
* @param \Magento\Catalog\Helper\Output $outputHelper
44+
* @param ScopeConfigInterface|null $scopeConfig
3145
*/
3246
public function __construct(
3347
\Magento\Catalog\Helper\Product\Compare $helper,
3448
\Magento\Catalog\Model\Product\Url $productUrl,
35-
\Magento\Catalog\Helper\Output $outputHelper
49+
\Magento\Catalog\Helper\Output $outputHelper,
50+
?ScopeConfigInterface $scopeConfig = null
3651
) {
3752
$this->helper = $helper;
3853
$this->productUrl = $productUrl;
3954
$this->outputHelper = $outputHelper;
55+
$this->scopeConfig = $scopeConfig ?? ObjectManager::getInstance()->get(ScopeConfigInterface::class);
4056
}
4157

4258
/**
43-
* {@inheritdoc}
59+
* @inheritdoc
4460
*/
4561
public function getSectionData()
4662
{
@@ -54,18 +70,26 @@ public function getSectionData()
5470
}
5571

5672
/**
73+
* Get the list of compared product items
74+
*
5775
* @return array
76+
* @throws LocalizedException
5877
*/
5978
protected function getItems()
6079
{
6180
$items = [];
81+
$productsScope = $this->scopeConfig->getValue(
82+
'catalog/recently_products/scope',
83+
\Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE
84+
);
6285
/** @var \Magento\Catalog\Model\Product $item */
6386
foreach ($this->helper->getItemCollection() as $item) {
6487
$items[] = [
6588
'id' => $item->getId(),
6689
'product_url' => $this->productUrl->getUrl($item),
6790
'name' => $this->outputHelper->productAttribute($item, $item->getName(), 'name'),
6891
'remove_url' => $this->helper->getPostDataRemove($item),
92+
'productScope' => $productsScope
6993
];
7094
}
7195
return $items;

app/code/Magento/Catalog/Helper/Image.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,15 @@ class Image extends AbstractHelper implements ArgumentInterface
4444
* Scheduled for rotate image
4545
*
4646
* @var bool
47+
* @deprecated unused
4748
*/
4849
protected $_scheduleRotate = false;
4950

5051
/**
5152
* Angle
5253
*
5354
* @var int
55+
* @deprecated unused
5456
*/
5557
protected $_angle;
5658

@@ -408,6 +410,7 @@ public function backgroundColor($colorRGB)
408410
*
409411
* @param int $angle
410412
* @return $this
413+
* @deprecated unused
411414
*/
412415
public function rotate($angle)
413416
{
@@ -620,6 +623,7 @@ protected function _getModel()
620623
*
621624
* @param int $angle
622625
* @return $this
626+
* @deprecated unused
623627
*/
624628
protected function setAngle($angle)
625629
{
@@ -631,6 +635,7 @@ protected function setAngle($angle)
631635
* Get Rotation Angle
632636
*
633637
* @return int
638+
* @deprecated unused
634639
*/
635640
protected function getAngle()
636641
{

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

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@
1010
use Magento\Catalog\Model\View\Asset\PlaceholderFactory;
1111
use Magento\Framework\App\Filesystem\DirectoryList;
1212
use Magento\Framework\App\ObjectManager;
13+
use Magento\Framework\Exception\FileSystemException;
1314
use Magento\Framework\Image as MagentoImage;
1415
use Magento\Framework\Serialize\SerializerInterface;
1516
use Magento\Catalog\Model\Product\Image\ParamsBuilder;
1617
use Magento\Framework\Storage\StorageInterface;
1718
use Magento\Framework\Storage\StorageProvider;
19+
use Magento\Framework\Filesystem\Driver\File as FilesystemDriver;
1820

1921
/**
2022
* Image operations
@@ -103,6 +105,7 @@ class Image extends \Magento\Framework\Model\AbstractModel
103105

104106
/**
105107
* @var int
108+
* @deprecated unused
106109
*/
107110
protected $_angle;
108111

@@ -206,6 +209,11 @@ class Image extends \Magento\Framework\Model\AbstractModel
206209
*/
207210
private $storage;
208211

212+
/**
213+
* @var FilesystemDriver
214+
*/
215+
private $filesystemDriver;
216+
209217
/**
210218
* Constructor
211219
*
@@ -227,6 +235,8 @@ class Image extends \Magento\Framework\Model\AbstractModel
227235
* @param array $data
228236
* @param SerializerInterface $serializer
229237
* @param ParamsBuilder $paramsBuilder
238+
* @param FilesystemDriver $filesystemDriver
239+
* @throws \Magento\Framework\Exception\FileSystemException
230240
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
231241
* @SuppressWarnings(PHPMD.UnusedLocalVariable)
232242
*/
@@ -248,7 +258,8 @@ public function __construct(
248258
\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
249259
array $data = [],
250260
SerializerInterface $serializer = null,
251-
ParamsBuilder $paramsBuilder = null
261+
ParamsBuilder $paramsBuilder = null,
262+
FilesystemDriver $filesystemDriver = null
252263
) {
253264
$this->_storeManager = $storeManager;
254265
$this->_catalogProductMediaConfig = $catalogProductMediaConfig;
@@ -267,6 +278,7 @@ public function __construct(
267278
$this->viewAssetPlaceholderFactory = $viewAssetPlaceholderFactory;
268279
$this->serializer = $serializer ?: ObjectManager::getInstance()->get(SerializerInterface::class);
269280
$this->paramsBuilder = $paramsBuilder ?: ObjectManager::getInstance()->get(ParamsBuilder::class);
281+
$this->filesystemDriver = $filesystemDriver ?: ObjectManager::getInstance()->get(FilesystemDriver::class);
270282
}
271283

272284
/**
@@ -538,6 +550,7 @@ public function resize()
538550
*
539551
* @param int $angle
540552
* @return $this
553+
* @deprecated unused
541554
*/
542555
public function rotate($angle)
543556
{
@@ -553,6 +566,7 @@ public function rotate($angle)
553566
*
554567
* @param int $angle
555568
* @return $this
569+
* @deprecated unused
556570
*/
557571
public function setAngle($angle)
558572
{

0 commit comments

Comments
 (0)