Skip to content

Commit ef58edb

Browse files
🔃 [EngCom] Public Pull Requests - 2.3-develop
Accepted Public Pull Requests: - #21474: Refactoring the Form class (by @eduard13) - #21338: [Catalog] [MediaStorage] Fix watermark in media application (by @progreg) - #21443: Fixed #21425 Date design change show not correctly value in backend (by @shikhamis11) - #21356: Checkout Page Cancel button is not working #21327 (by @Jitheesh) - #20482: [TASK] Remove translation of attribute store label in getAdditionalData (by @c-walter) - #20316: Change product_price_value in cart data section based on tax settings (by @NickdeK) - #21363: [Catalog] Fixing the Products grid with default values on multi stores (by @eduard13) - #21275: Static tests: forbid 'or' instead of '||' #21062. (by @novikor) - #21094: Also populate the storesCache when importing product only on storevie� (by @hostep) - #21130: Remove unused use statement in Wishlist Allcart Controller (by @oshancp) Fixed GitHub Issues: - #21154: 2.3.0 Watermark not showing on images (reported by @travis5491811) has been fixed in #21338 by @progreg in 2.3-develop branch Related commits: 1. c7930eb 2. 7190983 - #21425: Date design change show not correctly value in backend (reported by @mrtuvn) has been fixed in #21443 by @shikhamis11 in 2.3-develop branch Related commits: 1. 68ee3af 2. 8e95bfd 3. f0a98a5 - #21327: Checkout Page Cancel button is not working (reported by @speedy008) has been fixed in #21356 by @Jitheesh in 2.3-develop branch Related commits: 1. 4a598e7 2. 5372fdc 3. 642a4eb - #20310: Cart section data has wrong product_price_value (reported by @NickdeK) has been fixed in #20316 by @NickdeK in 2.3-develop branch Related commits: 1. 764612e 2. 7c7b078 3. 3c8c4a7 - #13338: Products grid in admin does not display default values? (reported by @VincentMarmiesse) has been fixed in #21363 by @eduard13 in 2.3-develop branch Related commits: 1. a0be69b 2. 9e657ad 3. 5d2ffad 4. edc66ba 5. 14dbb4f - #21062: Static tests: forbid 'or' instead of '||' (reported by @novikor) has been fixed in #21275 by @novikor in 2.3-develop branch Related commits: 1. 23f415a
2 parents 9ef2d45 + bccbc02 commit ef58edb

File tree

14 files changed

+246
-23
lines changed

14 files changed

+246
-23
lines changed

app/code/Magento/Backend/Block/System/Design/Edit/Tab/General.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
namespace Magento\Backend\Block\System\Design\Edit\Tab;
88

9+
/**
10+
* General system tab block.
11+
*/
912
class General extends \Magento\Backend\Block\Widget\Form\Generic
1013
{
1114
/**
@@ -90,7 +93,7 @@ protected function _prepareForm()
9093
]
9194
);
9295

93-
$dateFormat = $this->_localeDate->getDateFormat(\IntlDateFormatter::SHORT);
96+
$dateFormat = $this->_localeDate->getDateFormatWithLongYear();
9497
$fieldset->addField(
9598
'date_from',
9699
'date',

app/code/Magento/Catalog/Block/Product/View/Attributes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public function getAdditionalData(array $excludeAttr = [])
9494

9595
if (is_string($value) && strlen(trim($value))) {
9696
$data[$attribute->getAttributeCode()] = [
97-
'label' => __($attribute->getStoreLabel()),
97+
'label' => $attribute->getStoreLabel(),
9898
'value' => $value,
9999
'code' => $attribute->getAttributeCode(),
100100
];

app/code/Magento/Catalog/Test/Unit/Ui/DataProvider/Product/ProductCustomOptionsDataProviderTest.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,16 @@ protected function setUp()
5454
->getMockForAbstractClass();
5555
$this->collectionMock = $this->getMockBuilder(AbstractCollection::class)
5656
->disableOriginalConstructor()
57-
->setMethods(['load', 'getSelect', 'getTable', 'getIterator', 'isLoaded', 'toArray', 'getSize'])
57+
->setMethods([
58+
'load',
59+
'getSelect',
60+
'getTable',
61+
'getIterator',
62+
'isLoaded',
63+
'toArray',
64+
'getSize',
65+
'setStoreId'
66+
])
5867
->getMockForAbstractClass();
5968
$this->dbSelectMock = $this->getMockBuilder(DbSelect::class)
6069
->disableOriginalConstructor()

app/code/Magento/Catalog/Ui/DataProvider/Product/ProductDataProvider.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
use Magento\Catalog\Model\ResourceModel\Product\CollectionFactory;
99
use Magento\Framework\App\ObjectManager;
10+
use Magento\Store\Model\Store;
1011
use Magento\Ui\DataProvider\Modifier\ModifierInterface;
1112
use Magento\Ui\DataProvider\Modifier\PoolInterface;
1213

@@ -67,6 +68,7 @@ public function __construct(
6768
$this->addFieldStrategies = $addFieldStrategies;
6869
$this->addFilterStrategies = $addFilterStrategies;
6970
$this->modifiersPool = $modifiersPool ?: ObjectManager::getInstance()->get(PoolInterface::class);
71+
$this->collection->setStoreId(Store::DEFAULT_STORE_ID);
7072
}
7173

7274
/**
@@ -110,7 +112,7 @@ public function addField($field, $alias = null)
110112
}
111113

112114
/**
113-
* {@inheritdoc}
115+
* @inheritdoc
114116
*/
115117
public function addFilter(\Magento\Framework\Api\Filter $filter)
116118
{

app/code/Magento/CatalogUrlRewrite/Observer/AfterImportDataObserver.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ protected function _populateForUrlGeneration($rowData)
263263
if ($this->isGlobalScope($product->getStoreId())) {
264264
$this->populateGlobalProduct($product);
265265
} else {
266+
$this->storesCache[$product->getStoreId()] = true;
266267
$this->addProductToImport($product, $product->getStoreId());
267268
}
268269
return $this;

app/code/Magento/Checkout/view/frontend/web/js/view/billing-address.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,13 @@ function (
202202
}
203203
},
204204

205+
/**
206+
* Manage cancel button visibility
207+
*/
208+
canUseCancelBillingAddress: ko.computed(function () {
209+
return quote.billingAddress() || lastSelectedBillingAddress;
210+
}),
211+
205212
/**
206213
* Restore billing address
207214
*/

app/code/Magento/Checkout/view/frontend/web/template/billing-address.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<button class="action action-update" type="button" data-bind="click: updateAddress">
2323
<span data-bind="i18n: 'Update'"></span>
2424
</button>
25-
<button class="action action-cancel" type="button" data-bind="click: cancelAddressEdit">
25+
<button class="action action-cancel" type="button" data-bind="click: cancelAddressEdit, visible: canUseCancelBillingAddress()">
2626
<span data-bind="i18n: 'Cancel'"></span>
2727
</button>
2828
</div>

app/code/Magento/MediaStorage/Service/ImageResize.php

Lines changed: 48 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
use Magento\Framework\App\Filesystem\DirectoryList;
2525

2626
/**
27+
* Image resize service.
28+
*
2729
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2830
*/
2931
class ImageResize
@@ -123,7 +125,8 @@ public function __construct(
123125
}
124126

125127
/**
126-
* Create resized images of different sizes from an original image
128+
* Create resized images of different sizes from an original image.
129+
*
127130
* @param string $originalImageName
128131
* @throws NotFoundException
129132
*/
@@ -141,7 +144,8 @@ public function resizeFromImageName(string $originalImageName)
141144
}
142145

143146
/**
144-
* Create resized images of different sizes from themes
147+
* Create resized images of different sizes from themes.
148+
*
145149
* @param array|null $themes
146150
* @return \Generator
147151
* @throws NotFoundException
@@ -169,7 +173,8 @@ public function resizeFromThemes(array $themes = null): \Generator
169173
}
170174

171175
/**
172-
* Search the current theme
176+
* Search the current theme.
177+
*
173178
* @return array
174179
*/
175180
private function getThemesInUse(): array
@@ -187,7 +192,8 @@ private function getThemesInUse(): array
187192
}
188193

189194
/**
190-
* Get view images data from themes
195+
* Get view images data from themes.
196+
*
191197
* @param array $themes
192198
* @return array
193199
*/
@@ -211,7 +217,8 @@ private function getViewImages(array $themes): array
211217
}
212218

213219
/**
214-
* Get unique image index
220+
* Get unique image index.
221+
*
215222
* @param array $imageData
216223
* @return string
217224
*/
@@ -223,7 +230,8 @@ private function getUniqueImageIndex(array $imageData): string
223230
}
224231

225232
/**
226-
* Make image
233+
* Make image.
234+
*
227235
* @param string $originalImagePath
228236
* @param array $imageParams
229237
* @return Image
@@ -241,7 +249,8 @@ private function makeImage(string $originalImagePath, array $imageParams): Image
241249
}
242250

243251
/**
244-
* Resize image
252+
* Resize image.
253+
*
245254
* @param array $viewImage
246255
* @param string $originalImagePath
247256
* @param string $originalImageName
@@ -257,9 +266,41 @@ private function resize(array $viewImage, string $originalImagePath, string $ori
257266
]
258267
);
259268

269+
if (isset($imageParams['watermark_file'])) {
270+
if ($imageParams['watermark_height'] !== null) {
271+
$image->setWatermarkHeight($imageParams['watermark_height']);
272+
}
273+
274+
if ($imageParams['watermark_width'] !== null) {
275+
$image->setWatermarkWidth($imageParams['watermark_width']);
276+
}
277+
278+
if ($imageParams['watermark_position'] !== null) {
279+
$image->setWatermarkPosition($imageParams['watermark_position']);
280+
}
281+
282+
if ($imageParams['watermark_image_opacity'] !== null) {
283+
$image->setWatermarkImageOpacity($imageParams['watermark_image_opacity']);
284+
}
285+
286+
$image->watermark($this->getWatermarkFilePath($imageParams['watermark_file']));
287+
}
288+
260289
if ($imageParams['image_width'] !== null && $imageParams['image_height'] !== null) {
261290
$image->resize($imageParams['image_width'], $imageParams['image_height']);
262291
}
263292
$image->save($imageAsset->getPath());
264293
}
294+
295+
/**
296+
* Returns watermark file absolute path
297+
*
298+
* @param string $file
299+
* @return string
300+
*/
301+
private function getWatermarkFilePath($file)
302+
{
303+
$path = $this->imageConfig->getMediaPath('/watermark/' . $file);
304+
return $this->mediaDirectory->getAbsolutePath($path);
305+
}
265306
}

app/code/Magento/Sales/Controller/Guest/Form.php

Lines changed: 41 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,40 +4,72 @@
44
* Copyright © Magento, Inc. All rights reserved.
55
* See COPYING.txt for license details.
66
*/
7+
declare(strict_types=1);
8+
79
namespace Magento\Sales\Controller\Guest;
810

9-
class Form extends \Magento\Framework\App\Action\Action
11+
use Magento\Customer\Model\Session as CustomerSession;
12+
use Magento\Framework\App\Action\Context;
13+
use Magento\Framework\App\Action\HttpGetActionInterface;
14+
use Magento\Framework\App\ObjectManager;
15+
use Magento\Framework\Controller\Result\Redirect;
16+
use Magento\Framework\View\Result\Page;
17+
use Magento\Framework\View\Result\PageFactory;
18+
use Magento\Sales\Helper\Guest as GuestHelper;
19+
20+
/**
21+
* Class Form
22+
*/
23+
class Form extends \Magento\Framework\App\Action\Action implements HttpGetActionInterface
1024
{
1125
/**
12-
* @var \Magento\Framework\View\Result\PageFactory
26+
* @var PageFactory
1327
*/
1428
protected $resultPageFactory;
1529

1630
/**
17-
* @param \Magento\Framework\App\Action\Context $context
18-
* @param \Magento\Framework\View\Result\PageFactory $resultPageFactory
31+
* @var CustomerSession|null
32+
*/
33+
private $customerSession;
34+
35+
/**
36+
* @var GuestHelper|null
37+
*/
38+
private $guestHelper;
39+
40+
/**
41+
* @param Context $context
42+
* @param PageFactory $resultPageFactory
43+
* @param CustomerSession|null $customerSession
44+
* @param GuestHelper|null $guestHelper
1945
*/
2046
public function __construct(
21-
\Magento\Framework\App\Action\Context $context,
22-
\Magento\Framework\View\Result\PageFactory $resultPageFactory
47+
Context $context,
48+
PageFactory $resultPageFactory,
49+
CustomerSession $customerSession = null,
50+
GuestHelper $guestHelper = null
2351
) {
2452
parent::__construct($context);
2553
$this->resultPageFactory = $resultPageFactory;
54+
$this->customerSession = $customerSession ?: ObjectManager::getInstance()->get(CustomerSession::class);
55+
$this->guestHelper = $guestHelper ?: ObjectManager::getInstance()->get(GuestHelper::class);
2656
}
2757

2858
/**
2959
* Order view form page
3060
*
31-
* @return \Magento\Framework\Controller\Result\Redirect|\Magento\Framework\View\Result\Page
61+
* @return Redirect|Page
3262
*/
3363
public function execute()
3464
{
35-
if ($this->_objectManager->get(\Magento\Customer\Model\Session::class)->isLoggedIn()) {
65+
if ($this->customerSession->isLoggedIn()) {
3666
return $this->resultRedirectFactory->create()->setPath('customer/account/');
3767
}
68+
3869
$resultPage = $this->resultPageFactory->create();
3970
$resultPage->getConfig()->getTitle()->set(__('Orders and Returns'));
40-
$this->_objectManager->get(\Magento\Sales\Helper\Guest::class)->getBreadcrumbs($resultPage);
71+
$this->guestHelper->getBreadcrumbs($resultPage);
72+
4173
return $resultPage;
4274
}
4375
}

app/code/Magento/Tax/Plugin/Checkout/CustomerData/Cart.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66

77
namespace Magento\Tax\Plugin\Checkout\CustomerData;
88

9+
/**
10+
* Process quote items price, considering tax configuration.
11+
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
12+
*/
913
class Cart
1014
{
1115
/**
@@ -68,6 +72,16 @@ public function afterGetSectionData(\Magento\Checkout\CustomerData\Cart $subject
6872
$this->itemPriceRenderer->setItem($item);
6973
$this->itemPriceRenderer->setTemplate('checkout/cart/item/price/sidebar.phtml');
7074
$result['items'][$key]['product_price']=$this->itemPriceRenderer->toHtml();
75+
if ($this->itemPriceRenderer->displayPriceExclTax()) {
76+
$result['items'][$key]['product_price_value'] = $item->getCalculationPrice();
77+
} elseif ($this->itemPriceRenderer->displayPriceInclTax()) {
78+
$result['items'][$key]['product_price_value'] = $item->getPriceInclTax();
79+
} elseif ($this->itemPriceRenderer->displayBothPrices()) {
80+
//unset product price value in case price already has been set as scalar value.
81+
unset($result['items'][$key]['product_price_value']);
82+
$result['items'][$key]['product_price_value']['incl_tax'] = $item->getPriceInclTax();
83+
$result['items'][$key]['product_price_value']['excl_tax'] = $item->getCalculationPrice();
84+
}
7185
}
7286
}
7387
}

app/code/Magento/Wishlist/Controller/Index/Allcart.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,17 @@
55
*/
66
namespace Magento\Wishlist\Controller\Index;
77

8+
use Magento\Framework\App\Action\HttpPostActionInterface;
89
use Magento\Framework\Data\Form\FormKey\Validator;
9-
use Magento\Framework\App\Action;
1010
use Magento\Framework\App\Action\Context;
1111
use Magento\Wishlist\Controller\WishlistProviderInterface;
1212
use Magento\Wishlist\Model\ItemCarrier;
1313
use Magento\Framework\Controller\ResultFactory;
1414

15-
class Allcart extends \Magento\Wishlist\Controller\AbstractIndex
15+
/**
16+
* Action Add All to Cart
17+
*/
18+
class Allcart extends \Magento\Wishlist\Controller\AbstractIndex implements HttpPostActionInterface
1619
{
1720
/**
1821
* @var WishlistProviderInterface

0 commit comments

Comments
 (0)