Skip to content

Commit 70a3f89

Browse files
committed
Fix issues caused by using continue in loops
- Fix echoing "continue;" instead of executing it - Replace continue to opposite condition in if blocks (cherry picked from commit 2b47c8f)
1 parent adbf774 commit 70a3f89

File tree

9 files changed

+44
-61
lines changed

9 files changed

+44
-61
lines changed

app/code/Magento/Sales/view/frontend/templates/email/creditmemo/items.phtml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,11 @@
2525
</tr>
2626
</thead>
2727
<?php foreach ($_creditmemo->getAllItems() as $_item): ?>
28-
<?php
29-
if ($_item->getOrderItem()->getParentItem()) {
30-
continue;
31-
}
32-
?>
33-
<tbody>
34-
<?= $block->getItemHtml($_item) ?>
35-
</tbody>
28+
<?php if (!$_item->getOrderItem()->getParentItem()) : ?>
29+
<tbody>
30+
<?= $block->getItemHtml($_item) ?>
31+
</tbody>
32+
<?php endif; ?>
3633
<?php endforeach; ?>
3734
<tfoot class="order-totals">
3835
<?= $block->getChildHtml('creditmemo_totals') ?>

app/code/Magento/Sales/view/frontend/templates/email/invoice/items.phtml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,11 @@
2525
</tr>
2626
</thead>
2727
<?php foreach ($_invoice->getAllItems() as $_item): ?>
28-
<?php
29-
if ($_item->getOrderItem()->getParentItem()) {
30-
continue;
31-
}
32-
?>
33-
<tbody>
34-
<?= $block->getItemHtml($_item) ?>
35-
</tbody>
28+
<?php if (!$_item->getOrderItem()->getParentItem()) : ?>
29+
<tbody>
30+
<?= $block->getItemHtml($_item) ?>
31+
</tbody>
32+
<?php endif; ?>
3633
<?php endforeach; ?>
3734
<tfoot class="order-totals">
3835
<?= $block->getChildHtml('invoice_totals') ?>

app/code/Magento/Sales/view/frontend/templates/email/items.phtml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,11 @@
2525
</tr>
2626
</thead>
2727
<?php foreach ($_items as $_item): ?>
28-
<?php
29-
if ($_item->getParentItem()) {
30-
continue;
31-
}
32-
?>
33-
<tbody>
34-
<?= $block->getItemHtml($_item) ?>
35-
</tbody>
28+
<?php if (!$_item->getParentItem()) : ?>
29+
<tbody>
30+
<?= $block->getItemHtml($_item) ?>
31+
</tbody>
32+
<?php endif; ?>
3633
<?php endforeach; ?>
3734
<tfoot class="order-totals">
3835
<?= $block->getChildHtml('order_totals') ?>

app/code/Magento/Sales/view/frontend/templates/email/shipment/items.phtml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,11 @@
2222
</tr>
2323
</thead>
2424
<?php foreach ($_shipment->getAllItems() as $_item): ?>
25-
<?php
26-
if ($_item->getOrderItem()->getParentItem()) {
27-
continue;
28-
}
29-
?>
30-
<tbody>
31-
<?= $block->getItemHtml($_item) ?>
32-
</tbody>
25+
<?php if (!$_item->getOrderItem()->getParentItem()) : ?>
26+
<tbody>
27+
<?= $block->getItemHtml($_item) ?>
28+
</tbody>
29+
<?php endif; ?>
3330
<?php endforeach; ?>
3431
</table>
3532
<?php endif; ?>

app/code/Magento/Sales/view/frontend/templates/order/creditmemo/items.phtml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,11 @@
4141
</thead>
4242
<?php $_items = $_creditmemo->getAllItems(); ?>
4343
<?php foreach ($_items as $_item): ?>
44-
<?php if ($_item->getOrderItem()->getParentItem()) {
45-
continue;
46-
} ?>
47-
<tbody>
48-
<?= $block->getItemHtml($_item) ?>
49-
</tbody>
44+
<?php if (!$_item->getOrderItem()->getParentItem()): ?>
45+
<tbody>
46+
<?= $block->getItemHtml($_item) ?>
47+
</tbody>
48+
<?php endif; ?>
5049
<?php endforeach; ?>
5150
<tfoot>
5251
<?= $block->getTotalsHtml($_creditmemo) ?>

app/code/Magento/Sales/view/frontend/templates/order/invoice/items.phtml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,11 @@
3838
</thead>
3939
<?php $_items = $_invoice->getAllItems(); ?>
4040
<?php foreach ($_items as $_item): ?>
41-
<?php if ($_item->getOrderItem()->getParentItem()) {
42-
continue;
43-
} ?>
44-
<tbody>
45-
<?= $block->getItemHtml($_item) ?>
46-
</tbody>
41+
<?php if (!$_item->getOrderItem()->getParentItem()) : ?>
42+
<tbody>
43+
<?= $block->getItemHtml($_item) ?>
44+
</tbody>
45+
<?php endif; ?>
4746
<?php endforeach; ?>
4847
<tfoot>
4948
<?= $block->getInvoiceTotalsHtml($_invoice) ?>

app/code/Magento/Sales/view/frontend/templates/order/print/creditmemo.phtml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,11 @@
3535
</thead>
3636
<?php $_items = $_creditmemo->getAllItems(); ?>
3737
<?php foreach ($_items as $_item): ?>
38-
<?php if ($_item->getOrderItem()->getParentItem()): ?>
39-
continue;
40-
<?php endif; ?>
41-
<tbody>
42-
<?= $block->getItemHtml($_item) ?>
43-
</tbody>
38+
<?php if (!$_item->getOrderItem()->getParentItem()): ?>
39+
<tbody>
40+
<?= $block->getItemHtml($_item) ?>
41+
</tbody>
42+
<?php endif; ?>
4443
<?php endforeach; ?>
4544
<tfoot>
4645
<?= $block->getTotalsHtml($_creditmemo) ?>

app/code/Magento/Sales/view/frontend/templates/order/print/invoice.phtml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,11 @@
3333
</thead>
3434
<?php $_items = $_invoice->getItemsCollection(); ?>
3535
<?php foreach ($_items as $_item): ?>
36-
<?php if ($_item->getOrderItem()->getParentItem()): ?>
37-
continue;
36+
<?php if (!$_item->getOrderItem()->getParentItem()): ?>
37+
<tbody>
38+
<?= $block->getItemHtml($_item) ?>
39+
</tbody>
3840
<?php endif; ?>
39-
<tbody>
40-
<?= $block->getItemHtml($_item) ?>
41-
</tbody>
4241
<?php endforeach; ?>
4342
<tfoot>
4443
<?= $block->getInvoiceTotalsHtml($_invoice) ?>

app/code/Magento/Shipping/view/frontend/templates/items.phtml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,11 @@
6767
</thead>
6868
<?php $_items = $_shipment->getAllItems(); ?>
6969
<?php foreach ($_items as $_item): ?>
70-
<?php if ($_item->getOrderItem()->getParentItem()) {
71-
continue;
72-
} ?>
73-
<tbody>
74-
<?= $block->getItemHtml($_item) ?>
75-
</tbody>
70+
<?php if (!$_item->getOrderItem()->getParentItem()) : ?>
71+
<tbody>
72+
<?= $block->getItemHtml($_item) ?>
73+
</tbody>
74+
<?php endif; ?>
7675
<?php endforeach; ?>
7776
</table>
7877
</div>

0 commit comments

Comments
 (0)