Skip to content

Commit 71fc029

Browse files
committed
Merge pull request #15 from acidvertigo/patch-15
Change while loop with foreach
2 parents 844be3c + dc2afa9 commit 71fc029

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

catalog/shopping_cart.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
for ($i=0, $n=sizeof($products); $i<$n; $i++) {
4545
// Push all attributes information in an array
4646
if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {
47-
while (list($option, $value) = each($products[$i]['attributes'])) {
47+
foreach($products[$i]['attributes'] as $option => $value) {
4848
echo tep_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value);
4949
$attributes = tep_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix
5050
from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa
@@ -87,8 +87,7 @@
8787
}
8888

8989
if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {
90-
reset($products[$i]['attributes']);
91-
while (list($option, $value) = each($products[$i]['attributes'])) {
90+
foreach($products[$i]['attributes'] as $option => $value) {
9291
$products_name .= '<br /><small><i> - ' . $products[$i][$option]['products_options_name'] . ' ' . $products[$i][$option]['products_options_values_name'] . '</i></small>';
9392
}
9493
}
@@ -140,8 +139,7 @@
140139
<p align="right" style="clear: both; padding: 15px 50px 0 0;"><?php echo TEXT_ALTERNATIVE_CHECKOUT_METHODS; ?></p>
141140

142141
<?php
143-
reset($initialize_checkout_methods);
144-
while (list(, $value) = each($initialize_checkout_methods)) {
142+
foreach($initialize_checkout_methods as $value) {
145143
?>
146144

147145
<p align="right"><?php echo $value; ?></p>

0 commit comments

Comments
 (0)