Skip to content

Commit 86d0bac

Browse files
ENGCOM-6072: Resolve "Shopping Cart Summary" in backend is different from frontend , and not following the setting #25036 #25037
2 parents 9fb0c14 + 06e1461 commit 86d0bac

File tree

3 files changed

+34
-2
lines changed

3 files changed

+34
-2
lines changed

app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar/AbstractSidebar.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
7+
declare(strict_types=1);
8+
69
namespace Magento\Sales\Block\Adminhtml\Order\Create\Sidebar;
710

811
use Magento\Framework\Pricing\PriceCurrencyInterface;

app/code/Magento/Sales/Block/Adminhtml/Order/Create/Sidebar/Cart.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
use Magento\Catalog\Model\Product;
1111
use Magento\Catalog\Pricing\Price\FinalPrice;
12+
use Magento\Store\Model\ScopeInterface;
1213

1314
/**
1415
* Adminhtml sales order create sidebar cart block
@@ -146,4 +147,30 @@ private function getCartItemCustomPrice(Product $product): ?float
146147

147148
return null;
148149
}
150+
151+
/**
152+
* @inheritdoc
153+
*/
154+
public function getItemCount()
155+
{
156+
$count = $this->getData('item_count');
157+
if ($count === null) {
158+
$useQty = $this->_scopeConfig->getValue(
159+
'checkout/cart_link/use_qty',
160+
ScopeInterface::SCOPE_STORE
161+
);
162+
$allItems = $this->getItems();
163+
if ($useQty) {
164+
$count = 0;
165+
foreach ($allItems as $item) {
166+
$count += $item->getQty();
167+
}
168+
} else {
169+
$count = count($allItems);
170+
}
171+
$this->setData('item_count', $count);
172+
}
173+
174+
return $count;
175+
}
149176
}

app/code/Magento/Sales/Test/Mftf/Test/AddSimpleProductToOrderFromShoppingCartTest.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,9 @@
4646
</actionGroup>
4747

4848
<!-- Add product to cart -->
49-
<actionGroup ref="AddSimpleProductToCart" stepKey="addProductToCart">
49+
<actionGroup ref="StorefrontAddSimpleProductWithQtyActionGroup" stepKey="addSimpleProductToCart">
5050
<argument name="product" value="$$createProduct$$"/>
51+
<argument name="quantity" value="2"/>
5152
</actionGroup>
5253

5354
<!-- Login as admin -->
@@ -64,6 +65,7 @@
6465
<click selector="{{AdminCustomerMainActionsSection.createOrderBtn}}" stepKey="clickCreateOrder"/>
6566

6667
<!-- Check product in customer's activities in shopping cart section -->
68+
<see selector="{{AdminCreateOrderShoppingCartSection.shoppingCartBlock}}" userInput="Shopping Cart (2)" stepKey="seeCorrectNumberInCart"/>
6769
<see selector="{{AdminCustomerActivitiesShoppingCartSection.productName}}" userInput="$$createProduct.name$$" stepKey="seeProductNameInShoppingCartSection"/>
6870
<see selector="{{AdminCustomerActivitiesShoppingCartSection.productPrice}}" userInput="$$createProduct.price$$" stepKey="seeProductPriceInShoppingCartSection"/>
6971

@@ -75,6 +77,6 @@
7577
<!-- Assert product in items ordered grid -->
7678
<see selector="{{AdminCustomerCreateNewOrderSection.productName}}" userInput="$$createProduct.name$$" stepKey="seeProductName"/>
7779
<see selector="{{AdminCustomerCreateNewOrderSection.productPrice}}" userInput="$$createProduct.price$$" stepKey="seeProductPrice"/>
78-
<seeInField selector="{{AdminCustomerCreateNewOrderSection.productQty}}" userInput="{{ApiSimpleSingleQty.quantity}}" stepKey="seeProductQty"/>
80+
<seeInField selector="{{AdminCustomerCreateNewOrderSection.productQty}}" userInput="2" stepKey="seeProductQty"/>
7981
</test>
8082
</tests>

0 commit comments

Comments
 (0)