File tree Expand file tree Collapse file tree 3 files changed +7
-27
lines changed
Sales/Controller/Adminhtml/Order/Create Expand file tree Collapse file tree 3 files changed +7
-27
lines changed Original file line number Diff line number Diff line change @@ -168,11 +168,17 @@ private function addItemToCart(
168
168
$ stockItemQuantity
169
169
);
170
170
}
171
-
171
+ //here $result has errors
172
172
if (is_string ($ result )) {
173
173
foreach (array_unique (explode ("\n" , $ result )) as $ error ) {
174
174
$ errors [] = $ this ->error ->create (__ ($ error )->render (), $ cartItemPosition , $ stockItemQuantity );
175
175
}
176
+ } elseif ($ result ->getHasError () && $ result ->getStockStateResult ()->getHasError ()) {
177
+ $ errors [] = $ this ->error ->create (
178
+ __ ($ result ->getStockStateResult ()->getMessage ())->render (),
179
+ $ cartItemPosition ,
180
+ $ stockItemQuantity
181
+ );
176
182
}
177
183
178
184
return $ errors ;
Original file line number Diff line number Diff line change @@ -1668,8 +1668,6 @@ public function addProduct(
1668
1668
}
1669
1669
1670
1670
$ parentItem = null ;
1671
- $ errors = [];
1672
- $ item = null ;
1673
1671
$ items = [];
1674
1672
foreach ($ cartCandidates as $ candidate ) {
1675
1673
// Child items can be sticked together only within their parent
Original file line number Diff line number Diff line change @@ -130,28 +130,4 @@ public function execute()
130
130
131
131
return $ resultRedirect ;
132
132
}
133
-
134
- /**
135
- * Collect all item errors
136
- *
137
- * @param $order
138
- * @return array
139
- */
140
- private function getItemErrors ($ order ): array
141
- {
142
- $ errors = [];
143
- $ items = $ order ->getAllItems ();
144
- foreach ($ items as $ item ) {
145
- if (!$ item ->getMessage (false )) {
146
- continue ;
147
- }
148
- foreach ($ item ->getMessage (false ) as $ message ) {
149
- if (!in_array ($ message , $ errors )) {
150
- $ errors [] = $ message ;
151
- }
152
- }
153
- }
154
-
155
- return $ errors ;
156
- }
157
133
}
You can’t perform that action at this time.
0 commit comments