File tree Expand file tree Collapse file tree 3 files changed +32
-17
lines changed Expand file tree Collapse file tree 3 files changed +32
-17
lines changed Original file line number Diff line number Diff line change 9
9
namespace Magento \Sales \Block \Adminhtml \Order \Create \Sidebar ;
10
10
11
11
use Magento \Framework \Pricing \PriceCurrencyInterface ;
12
- use Magento \Store \Model \ScopeInterface ;
13
12
14
13
/**
15
14
* Adminhtml sales order create sidebar block
@@ -136,20 +135,7 @@ public function getItemCount()
136
135
{
137
136
$ count = $ this ->getData ('item_count ' );
138
137
if ($ count === null ) {
139
- $ useQty = $ this ->_scopeConfig ->getValue (
140
- 'checkout/cart_link/use_qty ' ,
141
- ScopeInterface::SCOPE_STORE
142
- );
143
- $ allItems = $ this ->getItems ();
144
- if ($ useQty ) {
145
- $ count = 0 ;
146
- foreach ($ allItems as $ item ) {
147
- $ count += $ item ->getQty ();
148
- }
149
- } else {
150
- $ count = count ($ allItems );
151
- }
152
-
138
+ $ count = count ($ this ->getItems ());
153
139
$ this ->setData ('item_count ' , $ count );
154
140
}
155
141
return $ count ;
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