@@ -24,40 +24,32 @@ class QuantityCollector
24
24
*/
25
25
public function collectItemsQtys (Quote $ quote )
26
26
{
27
- if (!isset ($ this ->quoteCache [$ quote ->getEntityId ()])) {
28
- $ quoteItems = $ quote ->getAllVisibleItems ();
29
- $ quote ->setItemsCount (0 );
30
- $ quote ->setItemsQty (0 );
31
- $ quote ->setVirtualItemsQty (0 );
32
-
33
- foreach ($ quoteItems as $ item ) {
34
- if ($ item ->getParentItem ()) {
35
- continue ;
36
- }
27
+ $ quoteItems = $ quote ->getAllVisibleItems ();
28
+ $ quote ->setItemsCount (0 );
29
+ $ quote ->setItemsQty (0 );
30
+ $ quote ->setVirtualItemsQty (0 );
31
+
32
+ foreach ($ quoteItems as $ item ) {
33
+ if ($ item ->getParentItem ()) {
34
+ continue ;
35
+ }
37
36
38
- $ children = $ item ->getChildren ();
39
- if ($ children && $ item ->isShipSeparately ()) {
40
- foreach ($ children as $ child ) {
41
- if ($ child ->getProduct ()->getIsVirtual ()) {
42
- $ quote ->setVirtualItemsQty (
43
- $ quote ->getVirtualItemsQty () + $ child ->getQty () * $ item ->getQty ()
44
- );
45
- }
37
+ $ children = $ item ->getChildren ();
38
+ if ($ children && $ item ->isShipSeparately ()) {
39
+ foreach ($ children as $ child ) {
40
+ if ($ child ->getProduct ()->getIsVirtual ()) {
41
+ $ quote ->setVirtualItemsQty ($ quote ->getVirtualItemsQty () + $ child ->getQty () * $ item ->getQty ());
46
42
}
47
43
}
48
-
49
- if ($ item ->getProduct ()->getIsVirtual ()) {
50
- $ quote ->setVirtualItemsQty ($ quote ->getVirtualItemsQty () + $ item ->getQty ());
51
- }
52
- $ quote ->setItemsCount ($ quote ->getItemsCount () + 1 );
53
- $ quote ->setItemsQty ((float )$ quote ->getItemsQty () + $ item ->getQty ());
54
44
}
55
45
56
- $ this ->quoteCache [$ quote ->getEntityId ()] = $ quote ;
57
-
58
- return $ quote ;
46
+ if ($ item ->getProduct ()->getIsVirtual ()) {
47
+ $ quote ->setVirtualItemsQty ($ quote ->getVirtualItemsQty () + $ item ->getQty ());
48
+ }
49
+ $ quote ->setItemsCount ($ quote ->getItemsCount () + 1 );
50
+ $ quote ->setItemsQty ((float )$ quote ->getItemsQty () + $ item ->getQty ());
59
51
}
60
52
61
- return $ this -> quoteCache [ $ quote-> getEntityId ()] ;
53
+ return $ quote ;
62
54
}
63
55
}
0 commit comments