6
6
// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis
7
7
/** @var $block \Magento\Bundle\Block\Sales\Order\Items\Renderer */
8
8
$ parentItem = $ block ->getItem ();
9
- $ items = array_merge ([$ parentItem ], $ parentItem ->getChildrenItems ());
9
+ $ items = $ block ->getOrderItems ((int )$ parentItem ->getOrderId (), (int )$ parentItem ->getId ());
10
+
10
11
$ index = 0 ;
11
12
$ prevOptionId = '' ;
12
13
?>
13
14
14
- <?php foreach ($ items as $ item ) : ?>
15
+ <?php foreach ($ items as $ item ): ?>
15
16
16
17
<?php if ($ block ->getItemOptions ()
17
18
|| $ parentItem ->getDescription ()
18
19
|| $ this ->helper (Magento \GiftMessage \Helper \Message::class)->isMessagesAllowed ('order_item ' , $ parentItem )
19
- && $ parentItem ->getGiftMessageId ()) : ?>
20
+ && $ parentItem ->getGiftMessageId ()): ?>
20
21
<?php $ showLastRow = true ; ?>
21
- <?php else : ?>
22
+ <?php else : ?>
22
23
<?php $ showLastRow = false ; ?>
23
24
<?php endif ; ?>
24
25
25
- <?php if ($ item ->getParentItem ()) : ?>
26
+ <?php if ($ item ->getParentItem ()): ?>
26
27
<?php $ attributes = $ block ->getSelectionAttributes ($ item ) ?>
27
- <?php if ($ prevOptionId != $ attributes ['option_id ' ]) : ?>
28
+
29
+ <?php if (isset ($ attributes ['option_id ' ]) && $ prevOptionId != $ attributes ['option_id ' ]): ?>
28
30
<tr class="options-label">
29
31
<td class="col label" colspan="5"><?= $ block ->escapeHtml ($ attributes ['option_label ' ]); ?> </td>
30
32
</tr>
31
33
<?php $ prevOptionId = $ attributes ['option_id ' ] ?>
32
34
<?php endif ; ?>
33
35
<?php endif ; ?>
34
36
<tr id="order-item-row-<?= /* @noEscape */ $ item ->getId () ?> "
35
- class="<?php if ($ item ->getParentItem ()) : ?>
37
+ class="<?php if ($ item ->getParentItem ()): ?>
36
38
item-options-container
37
- <?php else : ?>
39
+ <?php else : ?>
38
40
item-parent
39
41
<?php endif ; ?> "
40
- <?php if ($ item ->getParentItem ()) : ?>
41
- data-th="<?= $ block ->escapeHtmlAttr ($ attributes ['option_label ' ]); ?> "
42
+ <?php if ($ item ->getParentItem ()): ?>
43
+ data-th="<?= $ block ->escapeHtmlAttr ($ attributes ['option_label ' ] ?? '' ); ?> "
42
44
<?php endif ; ?> >
43
- <?php if (!$ item ->getParentItem ()) : ?>
45
+ <?php if (!$ item ->getParentItem ()): ?>
44
46
<td class="col name" data-th="<?= $ block ->escapeHtmlAttr (__ ('Product Name ' )); ?> ">
45
47
<strong class="product name product-item-name"><?= $ block ->escapeHtml ($ item ->getName ()); ?> </strong>
46
48
</td>
47
- <?php else : ?>
49
+ <?php else : ?>
48
50
<td class="col value" data-th="<?= $ block ->escapeHtmlAttr (__ ('Product Name ' )); ?> ">
49
51
<?= $ block ->getValueHtml ($ item ); ?>
50
52
</td>
@@ -53,82 +55,82 @@ $prevOptionId = '';
53
55
<?= /* @noEscape */ $ block ->prepareSku ($ item ->getSku ()); ?>
54
56
</td>
55
57
<td class="col price" data-th="<?= $ block ->escapeHtmlAttr (__ ('Price ' )); ?> ">
56
- <?php if (!$ item ->getParentItem ()) : ?>
58
+ <?php if (!$ item ->getParentItem ()): ?>
57
59
<?= /* @noEscape */ $ block ->getItemPriceHtml (); ?>
58
- <?php else : ?>
60
+ <?php else : ?>
59
61
60
62
<?php endif ; ?>
61
63
</td>
62
64
<td class="col qty" data-th="<?= $ block ->escapeHtmlAttr (__ ('Quantity ' )); ?> ">
63
65
<?php if (($ item ->getParentItem () && $ block ->isChildCalculated ()) ||
64
66
(!$ item ->getParentItem () && !$ block ->isChildCalculated ()) ||
65
- ($ item ->getQtyShipped () > 0 && $ item ->getParentItem () && $ block ->isShipmentSeparately ())) : ?>
67
+ ($ item ->getQtyShipped () > 0 && $ item ->getParentItem () && $ block ->isShipmentSeparately ())): ?>
66
68
<ul class="items-qty">
67
69
<?php endif ; ?>
68
70
<?php if (($ item ->getParentItem () && $ block ->isChildCalculated ()) ||
69
- (!$ item ->getParentItem () && !$ block ->isChildCalculated ())) : ?>
70
- <?php if ($ item ->getQtyOrdered () > 0 ) : ?>
71
+ (!$ item ->getParentItem () && !$ block ->isChildCalculated ())): ?>
72
+ <?php if ($ item ->getQtyOrdered () > 0 ): ?>
71
73
<li class="item">
72
74
<span class="title"><?= $ block ->escapeHtml (__ ('Ordered ' )); ?> </span>
73
75
<span class="content"><?= /* @noEscape */ $ item ->getQtyOrdered () * 1 ; ?> </span>
74
76
</li>
75
77
<?php endif ; ?>
76
- <?php if ($ item ->getQtyShipped () > 0 && !$ block ->isShipmentSeparately ()) : ?>
78
+ <?php if ($ item ->getQtyShipped () > 0 && !$ block ->isShipmentSeparately ()): ?>
77
79
<li class="item">
78
80
<span class="title"><?= $ block ->escapeHtml (__ ('Shipped ' )); ?> </span>
79
81
<span class="content"><?= /* @noEscape */ $ item ->getQtyShipped () * 1 ; ?> </span>
80
82
</li>
81
83
<?php endif ; ?>
82
- <?php if ($ item ->getQtyCanceled () > 0 ) : ?>
84
+ <?php if ($ item ->getQtyCanceled () > 0 ): ?>
83
85
<li class="item">
84
86
<span class="title"><?= $ block ->escapeHtml (__ ('Canceled ' )); ?> </span>
85
87
<span class="content"><?= /* @noEscape */ $ item ->getQtyCanceled () * 1 ; ?> </span>
86
88
</li>
87
89
<?php endif ; ?>
88
- <?php if ($ item ->getQtyRefunded () > 0 ) : ?>
90
+ <?php if ($ item ->getQtyRefunded () > 0 ): ?>
89
91
<li class="item">
90
92
<span class="title"><?= $ block ->escapeHtml (__ ('Refunded ' )); ?> </span>
91
93
<span class="content"><?= /* @noEscape */ $ item ->getQtyRefunded () * 1 ; ?> </span>
92
94
</li>
93
95
<?php endif ; ?>
94
- <?php elseif ($ item ->getQtyShipped () > 0 && $ item ->getParentItem () && $ block ->isShipmentSeparately ()) : ?>
96
+ <?php elseif ($ item ->getQtyShipped () > 0 && $ item ->getParentItem () && $ block ->isShipmentSeparately ()): ?>
95
97
<li class="item">
96
98
<span class="title"><?= $ block ->escapeHtml (__ ('Shipped ' )); ?> </span>
97
99
<span class="content"><?= /* @noEscape */ $ item ->getQtyShipped () * 1 ; ?> </span>
98
100
</li>
99
- <?php else : ?>
101
+ <?php else : ?>
100
102
<span class="content"><?= /* @noEscape */ $ parentItem ->getQtyOrdered () * 1 ; ?> </span>
101
103
<?php endif ; ?>
102
104
<?php if (($ item ->getParentItem () && $ block ->isChildCalculated ()) ||
103
105
(!$ item ->getParentItem () && !$ block ->isChildCalculated ()) ||
104
- ($ item ->getQtyShipped () > 0 && $ item ->getParentItem () && $ block ->isShipmentSeparately ())) :?>
106
+ ($ item ->getQtyShipped () > 0 && $ item ->getParentItem () && $ block ->isShipmentSeparately ())):?>
105
107
</ul>
106
108
<?php endif ; ?>
107
109
</td>
108
110
<td class="col subtotal" data-th="<?= $ block ->escapeHtmlAttr (__ ('Subtotal ' )) ?> ">
109
- <?php if (!$ item ->getParentItem ()) : ?>
111
+ <?php if (!$ item ->getParentItem ()): ?>
110
112
<?= /* @noEscape */ $ block ->getItemRowTotalHtml (); ?>
111
- <?php else : ?>
113
+ <?php else : ?>
112
114
113
115
<?php endif ; ?>
114
116
</td>
115
117
</tr>
116
118
<?php endforeach ; ?>
117
119
118
- <?php if ($ showLastRow && (($ options = $ block ->getItemOptions ()) || $ block ->escapeHtml ($ item ->getDescription ()))) : ?>
120
+ <?php if ($ showLastRow && (($ options = $ block ->getItemOptions ()) || $ block ->escapeHtml ($ item ->getDescription ()))): ?>
119
121
<tr>
120
122
<td class="col options" colspan="5">
121
- <?php if ($ options = $ block ->getItemOptions ()) : ?>
123
+ <?php if ($ options = $ block ->getItemOptions ()): ?>
122
124
<dl class="item-options">
123
- <?php foreach ($ options as $ option ) : ?>
125
+ <?php foreach ($ options as $ option ): ?>
124
126
<dt><?= $ block ->escapeHtml ($ option ['label ' ]) ?> </dt>
125
- <?php if (!$ block ->getPrintStatus ()) : ?>
127
+ <?php if (!$ block ->getPrintStatus ()): ?>
126
128
<?php $ formattedOptionValue = $ block ->getFormatedOptionValue ($ option ) ?>
127
- <dd<?php if (isset ($ formattedOptionValue ['full_view ' ])) : ?>
129
+ <dd<?php if (isset ($ formattedOptionValue ['full_view ' ])): ?>
128
130
class="tooltip wrapper"
129
131
<?php endif ; ?> >
130
132
<?= /* @noEscape */ $ formattedOptionValue ['value ' ] ?>
131
- <?php if (isset ($ formattedOptionValue ['full_view ' ])) : ?>
133
+ <?php if (isset ($ formattedOptionValue ['full_view ' ])): ?>
132
134
<div class="tooltip content">
133
135
<dl class="item options">
134
136
<dt><?= $ block ->escapeHtml ($ option ['label ' ]); ?> </dt>
@@ -137,7 +139,7 @@ $prevOptionId = '';
137
139
</div>
138
140
<?php endif ; ?>
139
141
</dd>
140
- <?php else : ?>
142
+ <?php else : ?>
141
143
<dd><?= $ block ->escapeHtml ((isset ($ option ['print_value ' ]) ?
142
144
$ option ['print_value ' ] :
143
145
$ option ['value ' ])); ?>
0 commit comments