Skip to content

Commit 5718cef

Browse files
committed
Merge branch '2.3-develop' of https://github.com/magento/magento2ce into MC-19689
2 parents 689a0b9 + 63cf5b3 commit 5718cef

File tree

55 files changed

+862
-766
lines changed

Some content is hidden

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

55 files changed

+862
-766
lines changed

app/code/Magento/Braintree/Model/Paypal/Helper/OrderPlace.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
/**
2020
* Class OrderPlace
2121
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
22+
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
2223
*/
2324
class OrderPlace extends AbstractHelper
2425
{
@@ -79,9 +80,10 @@ public function __construct(
7980
public function execute(Quote $quote, array $agreement)
8081
{
8182
if (!$this->agreementsValidator->isValid($agreement)) {
82-
throw new LocalizedException(__(
83+
$errorMsg = __(
8384
"The order wasn't placed. First, agree to the terms and conditions, then try placing your order again."
84-
));
85+
);
86+
throw new LocalizedException($errorMsg);
8587
}
8688

8789
if ($this->getCheckoutMethod($quote) === Onepage::METHOD_GUEST) {
@@ -91,12 +93,7 @@ public function execute(Quote $quote, array $agreement)
9193
$this->disabledQuoteAddressValidation($quote);
9294

9395
$quote->collectTotals();
94-
try {
95-
$this->cartManagement->placeOrder($quote->getId());
96-
} catch (\Exception $e) {
97-
$this->orderCancellationService->execute($quote->getReservedOrderId());
98-
throw $e;
99-
}
96+
$this->cartManagement->placeOrder($quote->getId());
10097
}
10198

10299
/**

app/code/Magento/Braintree/Plugin/OrderCancellation.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ public function aroundPlaceOrder(
7272
];
7373
if (in_array($payment->getMethod(), $paymentCodes)) {
7474
$incrementId = $quote->getReservedOrderId();
75-
$this->orderCancellationService->execute($incrementId);
75+
if ($incrementId) {
76+
$this->orderCancellationService->execute($incrementId);
77+
}
7678
}
7779

7880
throw $e;

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

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,12 @@ public function __construct(
6868
* Build image params
6969
*
7070
* @param array $imageArguments
71+
* @param int $scopeId
7172
* @return array
7273
* @SuppressWarnings(PHPMD.NPathComplexity)
7374
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
7475
*/
75-
public function build(array $imageArguments): array
76+
public function build(array $imageArguments, int $scopeId = null): array
7677
{
7778
$miscParams = [
7879
'image_type' => $imageArguments['type'] ?? null,
@@ -81,7 +82,7 @@ public function build(array $imageArguments): array
8182
];
8283

8384
$overwritten = $this->overwriteDefaultValues($imageArguments);
84-
$watermark = isset($miscParams['image_type']) ? $this->getWatermark($miscParams['image_type']) : [];
85+
$watermark = isset($miscParams['image_type']) ? $this->getWatermark($miscParams['image_type'], $scopeId) : [];
8586

8687
return array_merge($miscParams, $overwritten, $watermark);
8788
}
@@ -117,27 +118,32 @@ private function overwriteDefaultValues(array $imageArguments): array
117118
* Get watermark
118119
*
119120
* @param string $type
121+
* @param int $scopeId
120122
* @return array
121123
*/
122-
private function getWatermark(string $type): array
124+
private function getWatermark(string $type, int $scopeId = null): array
123125
{
124126
$file = $this->scopeConfig->getValue(
125127
"design/watermark/{$type}_image",
126-
ScopeInterface::SCOPE_STORE
128+
ScopeInterface::SCOPE_STORE,
129+
$scopeId
127130
);
128131

129132
if ($file) {
130133
$size = $this->scopeConfig->getValue(
131134
"design/watermark/{$type}_size",
132-
ScopeInterface::SCOPE_STORE
135+
ScopeInterface::SCOPE_STORE,
136+
$scopeId
133137
);
134138
$opacity = $this->scopeConfig->getValue(
135139
"design/watermark/{$type}_imageOpacity",
136-
ScopeInterface::SCOPE_STORE
140+
ScopeInterface::SCOPE_STORE,
141+
$scopeId
137142
);
138143
$position = $this->scopeConfig->getValue(
139144
"design/watermark/{$type}_position",
140-
ScopeInterface::SCOPE_STORE
145+
ScopeInterface::SCOPE_STORE,
146+
$scopeId
141147
);
142148
$width = !empty($size['width']) ? $size['width'] : null;
143149
$height = !empty($size['height']) ? $size['height'] : null;

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

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,8 @@ protected function _getResource()
167167
}
168168

169169
/**
170+
* Construct function
171+
*
170172
* @return void
171173
*/
172174
protected function _construct()
@@ -215,6 +217,8 @@ public function hasValues($type = null)
215217
}
216218

217219
/**
220+
* Get values
221+
*
218222
* @return ProductCustomOptionValuesInterface[]|null
219223
*/
220224
public function getValues()
@@ -345,7 +349,8 @@ public function groupFactory($type)
345349
}
346350

347351
/**
348-
* {@inheritdoc}
352+
* @inheritdoc
353+
*
349354
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
350355
* @since 101.0.0
351356
*/
@@ -396,6 +401,8 @@ public function beforeSave()
396401
}
397402

398403
/**
404+
* After save
405+
*
399406
* @return \Magento\Framework\Model\AbstractModel
400407
* @throws \Magento\Framework\Exception\LocalizedException
401408
*/
@@ -424,7 +431,8 @@ public function afterSave()
424431

425432
/**
426433
* Return price. If $flag is true and price is percent
427-
* return converted percent to price
434+
*
435+
* Return converted percent to price
428436
*
429437
* @param bool $flag
430438
* @return float
@@ -555,7 +563,7 @@ protected function _clearReferences()
555563
}
556564

557565
/**
558-
* {@inheritdoc}
566+
* @inheritdoc
559567
*/
560568
protected function _getValidationRulesBeforeSave()
561569
{
@@ -649,6 +657,8 @@ public function getSku()
649657
}
650658

651659
/**
660+
* Get file extension
661+
*
652662
* @return string|null
653663
*/
654664
public function getFileExtension()
@@ -657,6 +667,8 @@ public function getFileExtension()
657667
}
658668

659669
/**
670+
* Get Max Characters
671+
*
660672
* @return int|null
661673
*/
662674
public function getMaxCharacters()
@@ -665,6 +677,8 @@ public function getMaxCharacters()
665677
}
666678

667679
/**
680+
* Get image size X
681+
*
668682
* @return int|null
669683
*/
670684
public function getImageSizeX()
@@ -673,6 +687,8 @@ public function getImageSizeX()
673687
}
674688

675689
/**
690+
* Get image size Y
691+
*
676692
* @return int|null
677693
*/
678694
public function getImageSizeY()
@@ -780,6 +796,8 @@ public function setSku($sku)
780796
}
781797

782798
/**
799+
* Set File Extension
800+
*
783801
* @param string $fileExtension
784802
* @return $this
785803
*/
@@ -789,6 +807,8 @@ public function setFileExtension($fileExtension)
789807
}
790808

791809
/**
810+
* Set Max Characters
811+
*
792812
* @param int $maxCharacters
793813
* @return $this
794814
*/
@@ -798,6 +818,8 @@ public function setMaxCharacters($maxCharacters)
798818
}
799819

800820
/**
821+
* Set Image Size X
822+
*
801823
* @param int $imageSizeX
802824
* @return $this
803825
*/
@@ -807,6 +829,8 @@ public function setImageSizeX($imageSizeX)
807829
}
808830

809831
/**
832+
* Set Image Size Y
833+
*
810834
* @param int $imageSizeY
811835
* @return $this
812836
*/
@@ -816,6 +840,8 @@ public function setImageSizeY($imageSizeY)
816840
}
817841

818842
/**
843+
* Set value
844+
*
819845
* @param ProductCustomOptionValuesInterface[] $values
820846
* @return $this
821847
*/
@@ -826,7 +852,7 @@ public function setValues(array $values = null)
826852
}
827853

828854
/**
829-
* {@inheritdoc}
855+
* @inheritdoc
830856
*
831857
* @return \Magento\Catalog\Api\Data\ProductCustomOptionExtensionInterface|null
832858
*/
@@ -852,6 +878,8 @@ public function getRegularPrice()
852878
}
853879

854880
/**
881+
* Get Product Option Collection
882+
*
855883
* @param Product $product
856884
* @return \Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection
857885
*/
@@ -882,7 +910,7 @@ public function getProductOptionCollection(Product $product)
882910
}
883911

884912
/**
885-
* {@inheritdoc}
913+
* @inheritdoc
886914
*
887915
* @param \Magento\Catalog\Api\Data\ProductCustomOptionExtensionInterface $extensionAttributes
888916
* @return $this
@@ -894,6 +922,8 @@ public function setExtensionAttributes(
894922
}
895923

896924
/**
925+
* Get option repository
926+
*
897927
* @return Option\Repository
898928
*/
899929
private function getOptionRepository()
@@ -906,6 +936,8 @@ private function getOptionRepository()
906936
}
907937

908938
/**
939+
* Get metadata pool
940+
*
909941
* @return \Magento\Framework\EntityManager\MetadataPool
910942
*/
911943
private function getMetadataPool()
@@ -931,7 +963,7 @@ private function cleanFileExtensions()
931963
preg_match_all('/(?<extensions>[a-z0-9]+)/i', strtolower($rawExtensions), $matches);
932964
if (!empty($matches)) {
933965
$extensions = implode(', ', array_unique($matches['extensions']));
966+
$this->setFileExtension($extensions);
934967
}
935-
$this->setFileExtension($extensions);
936968
}
937969
}

app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductGridActionGroup.xml

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<annotations>
1414
<description>Sets the Admin Products grid view to the 'Default View'.</description>
1515
</annotations>
16-
16+
1717
<conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/>
1818
<click selector="{{AdminProductGridFilterSection.viewDropdown}}" stepKey="openViewBookmarksTab"/>
1919
<click selector="{{AdminProductGridFilterSection.viewBookmark('Default View')}}" stepKey="resetToDefaultGridView"/>
@@ -120,7 +120,7 @@
120120
<annotations>
121121
<description>Filters the Admin Products grid by the 'Enabled' Status. PLEASE NOTE: The Filter is Hardcoded.</description>
122122
</annotations>
123-
123+
124124
<conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial"/>
125125
<click selector="{{AdminProductGridFilterSection.filters}}" stepKey="openProductFilters"/>
126126
<selectOption selector="{{AdminProductGridFilterSection.statusFilter}}" userInput="Enabled" stepKey="selectEnabledStatusFilter"/>
@@ -286,6 +286,27 @@
286286
<see selector="{{AdminProductGridSection.productGridCell('1', 'Name')}}" userInput="{{name}}" stepKey="seeProductNameInGrid" after="clickApplyFilters"/>
287287
</actionGroup>
288288

289+
<actionGroup name="deleteProductsByKeyword">
290+
<annotations>
291+
<description>Delete products by keyword</description>
292+
</annotations>
293+
<arguments>
294+
<argument name="keyword" type="string"/>
295+
</arguments>
296+
297+
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="visitAdminProductPage"/>
298+
<conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/>
299+
<fillField selector="{{AdminProductGridFilterSection.keywordSearch}}" userInput="{{keyword}}" stepKey="fillKeywordField"/>
300+
<click selector="{{AdminProductGridFilterSection.keywordSearchButton}}" stepKey="keywordSearchButton"/>
301+
<click selector="{{AdminProductGridSection.multicheckDropdown}}" stepKey="openMulticheckDropdown"/>
302+
<click selector="{{AdminProductGridSection.multicheckOption('Select All')}}" stepKey="selectAllProductInFilteredGrid"/>
303+
<click selector="{{AdminProductGridSection.bulkActionDropdown}}" stepKey="clickActionDropdown"/>
304+
<click selector="{{AdminProductGridSection.bulkActionOption('Delete')}}" stepKey="clickDeleteAction"/>
305+
<waitForElementVisible selector="{{AdminConfirmationModalSection.ok}}" stepKey="waitForConfirmModal"/>
306+
<click selector="{{AdminConfirmationModalSection.ok}}" stepKey="confirmProductDelete"/>
307+
<see selector="{{AdminMessagesSection.success}}" userInput="record(s) have been deleted." stepKey="seeSuccessMessage"/>
308+
</actionGroup>
309+
289310
<!--Open product for edit by clicking row X and column Y in product grid-->
290311
<actionGroup name="openProducForEditByClickingRowXColumnYInProductGrid">
291312
<annotations>
@@ -314,7 +335,7 @@
314335
<annotations>
315336
<description>Filters the ID column in Ascending Order.</description>
316337
</annotations>
317-
338+
318339
<conditionalClick selector="{{AdminProductGridTableHeaderSection.id('descend')}}" dependentSelector="{{AdminProductGridTableHeaderSection.id('ascend')}}" visible="false" stepKey="sortById"/>
319340
<waitForPageLoad stepKey="waitForPageLoad"/>
320341
</actionGroup>

app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCheckProductPriceInCategoryActionGroup.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,14 @@
1717
<remove keyForRemoval="AssertProductPrice"/>
1818
<see userInput="{{product.price}}" selector="{{StorefrontCategoryProductSection.ProductPriceByName(product.name)}}" stepKey="AssertProductPrice"/>
1919
</actionGroup>
20+
<actionGroup name="StorefrontAssertProductPriceOnCategoryPageActionGroup" extends="StorefrontAssertProductPriceOnProductPageActionGroup">
21+
<annotations>
22+
<description>Validate that the provided Product Price is correct on category page.</description>
23+
</annotations>
24+
<arguments>
25+
<argument name="productName" type="string"/>
26+
</arguments>
27+
28+
<see userInput="{{productPrice}}" selector="{{StorefrontCategoryProductSection.ProductPriceByName(productName)}}" stepKey="seeProductPrice"/>
29+
</actionGroup>
2030
</actionGroups>

app/code/Magento/Catalog/Test/Mftf/Data/ProductAttributeData.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,4 +368,12 @@
368368
<data key="frontend_input">swatch_visual</data>
369369
<data key="attribute_code" unique="suffix">visual_swatch</data>
370370
</entity>
371+
<entity name="ProductColorAttribute" type="ProductAttribute">
372+
<data key="frontend_label">Color</data>
373+
<data key="attribute_code" unique="suffix">color_attr</data>
374+
</entity>
375+
<entity name="ProductSizeAttribute" type="ProductAttribute">
376+
<data key="frontend_label">Size</data>
377+
<data key="attribute_code" unique="suffix">size_attr</data>
378+
</entity>
371379
</entities>

0 commit comments

Comments
 (0)