Skip to content

Commit e4ad133

Browse files
[EngCom] Public Pull Requests - 2.3-develop
- merged latest code from mainline branch
2 parents c46a5e7 + 9cb874f commit e4ad133

File tree

48 files changed

+1468
-94
lines changed

Some content is hidden

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

48 files changed

+1468
-94
lines changed

app/code/Magento/Authorizenet/Model/Directpost.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -707,6 +707,7 @@ protected function processOrder(\Magento\Sales\Model\Order $order)
707707
//decline the order (in case of wrong response code) but don't return money to customer.
708708
$message = $e->getMessage();
709709
$this->declineOrder($order, $message, false);
710+
710711
throw $e;
711712
}
712713

@@ -777,7 +778,7 @@ protected function processPaymentFraudStatus(\Magento\Sales\Model\Order\Payment
777778
}
778779

779780
/**
780-
* Add status comment
781+
* Add status comment to history
781782
*
782783
* @param \Magento\Sales\Model\Order\Payment $payment
783784
* @return $this
@@ -832,6 +833,7 @@ protected function declineOrder(\Magento\Sales\Model\Order $order, $message = ''
832833
->void($response);
833834
}
834835
$order->registerCancellation($message)->save();
836+
$this->_eventManager->dispatch('order_cancel_after', ['order' => $order ]);
835837
} catch (\Exception $e) {
836838
//quiet decline
837839
$this->getPsrLogger()->critical($e);
@@ -866,7 +868,7 @@ public function getConfigInterface()
866868
* Getter for specified value according to set payment method code
867869
*
868870
* @param mixed $key
869-
* @param int|string|null|\Magento\Store\Model\Store $storeId
871+
* @param mixed $storeId
870872
* @return mixed
871873
*/
872874
public function getValue($key, $storeId = null)
@@ -930,7 +932,7 @@ public function fetchTransactionInfo(\Magento\Payment\Model\InfoInterface $payme
930932
}
931933

932934
/**
933-
* Add statuc comment on update.
935+
* Add status comment on update
934936
*
935937
* @param \Magento\Sales\Model\Order\Payment $payment
936938
* @param \Magento\Framework\DataObject $response

app/code/Magento/Catalog/Model/Product/Attribute/Backend/TierPrice/SaveHandler.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,12 +135,12 @@ private function getAdditionalFields(array $objectArray): array
135135
* Check whether price has percentage value.
136136
*
137137
* @param array $priceRow
138-
* @return int|null
138+
* @return float|null
139139
*/
140-
private function getPercentage(array $priceRow): ?int
140+
private function getPercentage(array $priceRow): ?float
141141
{
142142
return isset($priceRow['percentage_value']) && is_numeric($priceRow['percentage_value'])
143-
? (int)$priceRow['percentage_value']
143+
? (float)$priceRow['percentage_value']
144144
: null;
145145
}
146146

app/code/Magento/Catalog/Model/Product/Attribute/Backend/TierPrice/UpdateHandler.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,12 +138,12 @@ private function getAdditionalFields(array $objectArray): array
138138
* Check whether price has percentage value.
139139
*
140140
* @param array $priceRow
141-
* @return int|null
141+
* @return float|null
142142
*/
143-
private function getPercentage(array $priceRow): ?int
143+
private function getPercentage(array $priceRow): ?float
144144
{
145145
return isset($priceRow['percentage_value']) && is_numeric($priceRow['percentage_value'])
146-
? (int)$priceRow['percentage_value']
146+
? (float)$priceRow['percentage_value']
147147
: null;
148148
}
149149

app/code/Magento/Catalog/Model/ResourceModel/Category.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,8 +486,20 @@ public function getProductsPosition($category)
486486
$this->getCategoryProductTable(),
487487
['product_id', 'position']
488488
)->where(
489-
'category_id = :category_id'
489+
"{$this->getTable('catalog_category_product')}.category_id = ?",
490+
$category->getId()
490491
);
492+
$websiteId = $category->getStore()->getWebsiteId();
493+
if ($websiteId) {
494+
$select->join(
495+
['product_website' => $this->getTable('catalog_product_website')],
496+
"product_website.product_id = {$this->getTable('catalog_category_product')}.product_id",
497+
[]
498+
)->where(
499+
'product_website.website_id = ?',
500+
$websiteId
501+
);
502+
}
491503
$bind = ['category_id' => (int)$category->getId()];
492504

493505
return $this->getConnection()->fetchPairs($select, $bind);

app/code/Magento/Catalog/Model/ResourceModel/Category/Flat.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -699,8 +699,20 @@ public function getProductsPosition($category)
699699
$this->getTable('catalog_category_product'),
700700
['product_id', 'position']
701701
)->where(
702-
'category_id = :category_id'
702+
"{$this->getTable('catalog_category_product')}.category_id = ?",
703+
$category->getId()
703704
);
705+
$websiteId = $category->getStore()->getWebsiteId();
706+
if ($websiteId) {
707+
$select->join(
708+
['product_website' => $this->getTable('catalog_product_website')],
709+
"product_website.product_id = {$this->getTable('catalog_category_product')}.product_id",
710+
[]
711+
)->where(
712+
'product_website.website_id = ?',
713+
$websiteId
714+
);
715+
}
704716
$bind = ['category_id' => (int)$category->getId()];
705717

706718
return $this->getConnection()->fetchPairs($select, $bind);

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,17 @@
192192
<click selector="{{AdminProductGridConfirmActionSection.ok}}" stepKey="confirmProductDelete"/>
193193
</actionGroup>
194194

195+
<actionGroup name="deleteProductByName" extends="deleteProductBySku">
196+
<arguments>
197+
<argument name="sku" type="string" defaultValue=""/>
198+
<argument name="name" type="string"/>
199+
</arguments>
200+
<remove keyForRemoval="fillProductSkuFilter"/>
201+
<fillField selector="{{AdminProductGridFilterSection.nameFilter}}" userInput="{{name}}" stepKey="fillProductSkuFilter" after="openProductFilters"/>
202+
<remove keyForRemoval="seeProductSkuInGrid"/>
203+
<see selector="{{AdminProductGridSection.productGridCell('1', 'Name')}}" userInput="{{name}}" stepKey="seeProductNameInGrid" after="clickApplyFilters"/>
204+
</actionGroup>
205+
195206
<!--Open product for edit by clicking row X and column Y in product grid-->
196207
<actionGroup name="openProducForEditByClickingRowXColumnYInProductGrid">
197208
<arguments>

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,9 @@
181181
<requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity>
182182
<requiredEntity type="custom_attribute">CustomAttributeProductUrlKey</requiredEntity>
183183
</entity>
184+
<entity name="SetProductVisibilityHidden" type="product2">
185+
<data key="visibility">1</data>
186+
</entity>
184187
<entity name="ProductImage" type="uploadImage">
185188
<data key="title" unique="suffix">Image1</data>
186189
<data key="price">1.00</data>
@@ -477,4 +480,8 @@
477480
<requiredEntity type="product_extension_attribute">EavStock1</requiredEntity>
478481
<requiredEntity type="custom_attribute">CustomAttributeProductAttribute</requiredEntity>
479482
</entity>
483+
<entity name="ProductWithLongNameSku" extends="ApiSimpleProduct">
484+
<data key="name" unique="suffix">Product With Long Name And Sku - But not too long</data>
485+
<data key="sku" unique="suffix">Product With Long Name And Sku - But not too long</data>
486+
</entity>
480487
</entities>

app/code/Magento/Catalog/Test/Mftf/Test/AdminApplyTierPriceToProductTest.xml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,4 +269,56 @@
269269
<actualResult type="variable">grabTextFromMiniCartSubtotalField2</actualResult>
270270
</assertEquals>
271271
</test>
272+
<test name="AdminApplyTierPriceToProductWithPercentageDiscountTest">
273+
<annotations>
274+
<features value="Catalog"/>
275+
<stories value="MC-5517 - System tries to save 0 in Advanced Pricing which is invalid for Discount field"/>
276+
<title value="You should be able to apply tier price to a product with float percent discount."/>
277+
<description value="You should be able to apply tier price to a product with float percent discount."/>
278+
<severity value="AVERAGE"/>
279+
<testCaseId value="MAGETWO-96881"/>
280+
<group value="product"/>
281+
</annotations>
282+
<before>
283+
<createData entity="_defaultCategory" stepKey="createCategory"/>
284+
<createData entity="SimpleProduct" stepKey="createSimpleProduct">
285+
<requiredEntity createDataKey="createCategory"/>
286+
<field key="price">100</field>
287+
</createData>
288+
</before>
289+
<after>
290+
<deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/>
291+
<deleteData createDataKey="createCategory" stepKey="deleteCategory"/>
292+
<amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/>
293+
<waitForPageLoad time="30" stepKey="waitForProductIndexPageLoad"/>
294+
<actionGroup ref="resetProductGridToDefaultView" stepKey="resetGridToDefaultKeywordSearch"/>
295+
<actionGroup ref="logout" stepKey="logoutFromAdmin"/>
296+
</after>
297+
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
298+
<actionGroup ref="SearchForProductOnBackendActionGroup" stepKey="searchForSimpleProduct">
299+
<argument name="product" value="$$createSimpleProduct$$"/>
300+
</actionGroup>
301+
<actionGroup ref="OpenEditProductOnBackendActionGroup" stepKey="openEditProduct1">
302+
<argument name="product" value="$$createSimpleProduct$$"/>
303+
</actionGroup>
304+
<scrollToTopOfPage stepKey="scrollToTopOfPage"/>
305+
<click selector="{{AdminProductFormSection.advancedPricingLink}}" stepKey="clickOnAdvancedPricingButton"/>
306+
<waitForElement selector="{{AdminProductFormAdvancedPricingSection.customerGroupPriceAddButton}}" stepKey="waitForCustomerGroupPriceAddButton"/>
307+
<click selector="{{AdminProductFormAdvancedPricingSection.customerGroupPriceAddButton}}" stepKey="addCustomerGroupAllGroupsQty1PriceDiscountAndpercent"/>
308+
<fillField selector="{{AdminProductFormAdvancedPricingSection.productTierPriceQtyInput('0')}}" userInput="1" stepKey="fillProductTierPriceQtyInput"/>
309+
<selectOption selector="{{AdminProductFormAdvancedPricingSection.productTierPriceValueTypeSelect('0')}}" userInput="Discount" stepKey="selectProductTierPriceValueType"/>
310+
<fillField selector="{{AdminProductFormAdvancedPricingSection.productTierPricePercentageValuePriceInput('0')}}" userInput="0.1" stepKey="selectProductTierPricePriceInput"/>
311+
<click selector="{{AdminProductFormAdvancedPricingSection.doneButton}}" stepKey="clickDoneButton"/>
312+
<actionGroup ref="saveProductForm" stepKey="saveProduct1"/>
313+
<amOnPage url="{{StorefrontProductPage.url($$createSimpleProduct.sku$$)}}" stepKey="goProductPageOnStorefront"/>
314+
<waitForPageLoad time="30" stepKey="waitForPageLoad1"/>
315+
<seeElement selector="{{StorefrontCategoryProductSection.productPriceFinal('99.90')}}" stepKey="assertProductFinalPriceProductPage"/>
316+
<seeElement selector="{{StorefrontCategoryProductSection.productPriceLabel('Regular Price')}}" stepKey="assertRegularPriceProductPage"/>
317+
<seeElement selector="{{StorefrontCategoryProductSection.productPriceOld('100')}}" stepKey="assertRegularPriceAmountProductPage"/>
318+
<amOnPage url="{{StorefrontCategoryPage.url($$createCategory.name$$)}}" stepKey="navigateToCategoryPage"/>
319+
<waitForPageLoad time="30" stepKey="waitForPageLoad2"/>
320+
<seeElement selector="{{StorefrontCategoryProductSection.productPriceFinal('99.90')}}" stepKey="assertProductFinalPriceCategoryPage"/>
321+
<seeElement selector="{{StorefrontCategoryProductSection.productPriceLabel('Regular Price')}}" stepKey="assertRegularPriceLabelCategoryPage"/>
322+
<seeElement selector="{{StorefrontCategoryProductSection.productPriceOld('100')}}" stepKey="assertRegularPriceAmountCategoryPage"/>
323+
</test>
272324
</tests>

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public function __construct(
8282
}
8383

8484
/**
85-
* {@inheritdoc}
85+
* @inheritdoc
8686
*/
8787
public function getSectionData()
8888
{
@@ -158,11 +158,10 @@ protected function getRecentItems()
158158
: $item->getProduct();
159159

160160
$products = $this->catalogUrl->getRewriteByProductStore([$product->getId() => $item->getStoreId()]);
161-
if (!isset($products[$product->getId()])) {
162-
continue;
161+
if (isset($products[$product->getId()])) {
162+
$urlDataObject = new \Magento\Framework\DataObject($products[$product->getId()]);
163+
$item->getProduct()->setUrlDataObject($urlDataObject);
163164
}
164-
$urlDataObject = new \Magento\Framework\DataObject($products[$product->getId()]);
165-
$item->getProduct()->setUrlDataObject($urlDataObject);
166165
}
167166
$items[] = $this->itemPoolInterface->getItemData($item);
168167
}

app/code/Magento/Checkout/Model/DefaultConfigProvider.php

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,10 +282,12 @@ public function getConfig()
282282
$quote = $this->checkoutSession->getQuote();
283283
$quoteId = $quote->getId();
284284
$email = $quote->getShippingAddress()->getEmail();
285+
$quoteItemData = $this->getQuoteItemData();
285286
$output['formKey'] = $this->formKey->getFormKey();
286287
$output['customerData'] = $this->getCustomerData();
287288
$output['quoteData'] = $this->getQuoteData();
288-
$output['quoteItemData'] = $this->getQuoteItemData();
289+
$output['quoteItemData'] = $quoteItemData;
290+
$output['quoteMessages'] = $this->getQuoteItemsMessages($quoteItemData);
289291
$output['isCustomerLoggedIn'] = $this->isCustomerLoggedIn();
290292
$output['selectedShippingMethod'] = $this->getSelectedShippingMethod();
291293
if ($email && !$this->isCustomerLoggedIn()) {
@@ -316,6 +318,7 @@ public function getConfig()
316318
);
317319
$output['postCodes'] = $this->postCodesConfig->getPostCodes();
318320
$output['imageData'] = $this->imageProvider->getImages($quoteId);
321+
319322
$output['totalsData'] = $this->getTotalsData();
320323
$output['shippingPolicy'] = [
321324
'isEnabled' => $this->scopeConfig->isSetFlag(
@@ -450,6 +453,7 @@ private function getQuoteItemData()
450453
$quoteItem->getProduct(),
451454
'product_thumbnail_image'
452455
)->getUrl();
456+
$quoteItemData[$index]['message'] = $quoteItem->getMessage();
453457
}
454458
}
455459
return $quoteItemData;
@@ -776,4 +780,22 @@ private function getAttributeLabels(array $customAttribute, string $customAttrib
776780

777781
return $attributeOptionLabels;
778782
}
783+
784+
/**
785+
* Get notification messages for the quote items
786+
*
787+
* @param array $quoteItemData
788+
* @return array
789+
*/
790+
private function getQuoteItemsMessages(array $quoteItemData): array
791+
{
792+
$quoteItemsMessages = [];
793+
if ($quoteItemData) {
794+
foreach ($quoteItemData as $item) {
795+
$quoteItemsMessages[$item['item_id']] = $item['message'];
796+
}
797+
}
798+
799+
return $quoteItemsMessages;
800+
}
779801
}

0 commit comments

Comments
 (0)