File tree Expand file tree Collapse file tree 3 files changed +34
-2
lines changed Expand file tree Collapse file tree 3 files changed +34
-2
lines changed Original file line number Diff line number Diff line change 3
3
* Copyright © Magento, Inc. All rights reserved.
4
4
* See COPYING.txt for license details.
5
5
*/
6
+
7
+ declare (strict_types=1 );
8
+
6
9
namespace Magento \Sales \Block \Adminhtml \Order \Create \Sidebar ;
7
10
8
11
use Magento \Framework \Pricing \PriceCurrencyInterface ;
Original file line number Diff line number Diff line change 9
9
10
10
use Magento \Catalog \Model \Product ;
11
11
use Magento \Catalog \Pricing \Price \FinalPrice ;
12
+ use Magento \Store \Model \ScopeInterface ;
12
13
13
14
/**
14
15
* Adminhtml sales order create sidebar cart block
@@ -146,4 +147,30 @@ private function getCartItemCustomPrice(Product $product): ?float
146
147
147
148
return null ;
148
149
}
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
+ }
149
176
}
Original file line number Diff line number Diff line change 46
46
</actionGroup >
47
47
48
48
<!-- Add product to cart -->
49
- <actionGroup ref =" AddSimpleProductToCart " stepKey =" addProductToCart " >
49
+ <actionGroup ref =" StorefrontAddSimpleProductWithQtyActionGroup " stepKey =" addSimpleProductToCart " >
50
50
<argument name =" product" value =" $$createProduct$$" />
51
+ <argument name =" quantity" value =" 2" />
51
52
</actionGroup >
52
53
53
54
<!-- Login as admin -->
64
65
<click selector =" {{AdminCustomerMainActionsSection.createOrderBtn}}" stepKey =" clickCreateOrder" />
65
66
66
67
<!-- Check product in customer's activities in shopping cart section -->
68
+ <see selector =" {{AdminCreateOrderShoppingCartSection.shoppingCartBlock}}" userInput =" Shopping Cart (2)" stepKey =" seeCorrectNumberInCart" />
67
69
<see selector =" {{AdminCustomerActivitiesShoppingCartSection.productName}}" userInput =" $$createProduct.name$$" stepKey =" seeProductNameInShoppingCartSection" />
68
70
<see selector =" {{AdminCustomerActivitiesShoppingCartSection.productPrice}}" userInput =" $$createProduct.price$$" stepKey =" seeProductPriceInShoppingCartSection" />
69
71
75
77
<!-- Assert product in items ordered grid -->
76
78
<see selector =" {{AdminCustomerCreateNewOrderSection.productName}}" userInput =" $$createProduct.name$$" stepKey =" seeProductName" />
77
79
<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" />
79
81
</test >
80
82
</tests >
You can’t perform that action at this time.
0 commit comments