Skip to content

Commit de0f924

Browse files
[EngCom] Public Pull Requests - 2.3-develop
- merged latest code from mainline branch
2 parents 980307d + d653583 commit de0f924

File tree

18 files changed

+362
-119
lines changed

18 files changed

+362
-119
lines changed

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

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
* Shopping cart model
1717
*
1818
* @api
19+
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
1920
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2021
* @deprecated 100.1.0 Use \Magento\Quote\Model\Quote instead
2122
* @see \Magento\Quote\Api\Data\CartInterface
@@ -365,20 +366,10 @@ protected function _getProductRequest($requestInfo)
365366
public function addProduct($productInfo, $requestInfo = null)
366367
{
367368
$product = $this->_getProduct($productInfo);
368-
$request = $this->_getProductRequest($requestInfo);
369369
$productId = $product->getId();
370370

371371
if ($productId) {
372-
$stockItem = $this->stockRegistry->getStockItem($productId, $product->getStore()->getWebsiteId());
373-
$minimumQty = $stockItem->getMinSaleQty();
374-
//If product quantity is not specified in request and there is set minimal qty for it
375-
if ($minimumQty
376-
&& $minimumQty > 0
377-
&& !$request->getQty()
378-
) {
379-
$request->setQty($minimumQty);
380-
}
381-
372+
$request = $this->getQtyRequest($product, $requestInfo);
382373
try {
383374
$this->_eventManager->dispatch(
384375
'checkout_cart_product_add_before',
@@ -438,8 +429,9 @@ public function addProductsByIds($productIds)
438429
}
439430
$product = $this->_getProduct($productId);
440431
if ($product->getId() && $product->isVisibleInCatalog()) {
432+
$request = $this->getQtyRequest($product);
441433
try {
442-
$this->getQuote()->addProduct($product);
434+
$this->getQuote()->addProduct($product, $request);
443435
} catch (\Exception $e) {
444436
$allAdded = false;
445437
}
@@ -762,4 +754,27 @@ private function getRequestInfoFilter()
762754
}
763755
return $this->requestInfoFilter;
764756
}
757+
758+
/**
759+
* Get request quantity
760+
*
761+
* @param Product $product
762+
* @param \Magento\Framework\DataObject|int|array $request
763+
* @return int|DataObject
764+
*/
765+
private function getQtyRequest($product, $request = 0)
766+
{
767+
$request = $this->_getProductRequest($request);
768+
$stockItem = $this->stockRegistry->getStockItem($product->getId(), $product->getStore()->getWebsiteId());
769+
$minimumQty = $stockItem->getMinSaleQty();
770+
//If product quantity is not specified in request and there is set minimal qty for it
771+
if ($minimumQty
772+
&& $minimumQty > 0
773+
&& !$request->getQty()
774+
) {
775+
$request->setQty($minimumQty);
776+
}
777+
778+
return $request;
779+
}
765780
}

app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutTest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
<waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskToDisappearOnSearch"/>
6464
<click selector="{{AdminOrdersGridSection.firstRow}}" stepKey="clickOrderRow"/>
6565
<see selector="{{AdminOrderDetailsInformationSection.orderStatus}}" userInput="Pending" stepKey="seeAdminOrderStatus"/>
66-
<see selector="{{AdminOrderDetailsInformationSection.accountInformation}}" userInput="Guest" stepKey="seeAdminOrderGuest"/>
66+
<see selector="{{AdminOrderDetailsInformationSection.accountInformation}}" userInput="{{CustomerEntityOne.fullname}}" stepKey="seeAdminOrderGuest"/>
6767
<see selector="{{AdminOrderDetailsInformationSection.accountInformation}}" userInput="{{CustomerEntityOne.email}}" stepKey="seeAdminOrderEmail"/>
6868
<see selector="{{AdminOrderDetailsInformationSection.billingAddress}}" userInput="{{CustomerAddressSimple.street[0]}}" stepKey="seeAdminOrderBillingAddress"/>
6969
<see selector="{{AdminOrderDetailsInformationSection.shippingAddress}}" userInput="{{CustomerAddressSimple.street[0]}}" stepKey="seeAdminOrderShippingAddress"/>

app/code/Magento/Customer/Test/Mftf/Data/CustomerData.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
<data key="firstname">John</data>
2222
<data key="lastname">Doe</data>
2323
<data key="middlename">S</data>
24+
<data key="fullname">John Doe</data>
2425
<data key="password">pwdTest123!</data>
2526
<data key="prefix">Mr</data>
2627
<data key="suffix">Sr</data>

app/code/Magento/Dhl/Model/Carrier.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1964,9 +1964,7 @@ protected function isDutiable($origCountryId, $destCountryId) : bool
19641964
{
19651965
$this->_checkDomesticStatus($origCountryId, $destCountryId);
19661966

1967-
return
1968-
self::DHL_CONTENT_TYPE_NON_DOC == $this->getConfigData('content_type')
1969-
|| !$this->_isDomestic;
1967+
return !$this->_isDomestic;
19701968
}
19711969

19721970
/**

0 commit comments

Comments
 (0)