Created
August 23, 2015 22:44
-
-
Save NateJLewis/ba963c8b991543b21539 to your computer and use it in GitHub Desktop.
order form nested loop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ee()->load->helper('url'); | |
if(!ee()->uri->segment(3)) | |
{ | |
redirect("production"); | |
} | |
$q = ee()->db->query("call get_order_count(".ee()->uri->segment(3).")"); | |
$result = $q->result_array(); | |
$q->next_result(); | |
$q->free_result(); | |
foreach($result as $k => $v) | |
{ | |
// I don't think the $k['Style'] is correct but I tried | |
// everything else so basically I was wanting to loop through each style | |
foreach($k['Style']) { | |
// so this works fine without the 2nd foreach | |
echo '<tr>'; | |
echo '<td class="color" data-math="ignore">'.$v['Color'].'</td>'; | |
echo '<td class="style '.$v['Style'].'" data-math="ignore">'.$v['Style'].'</td>'; | |
if(isset($v['S'])) { | |
echo '<td class="text-center">'.$v['S'].'</td>'; | |
} else { | |
echo '<td class="text-center">0</td>'; | |
} | |
if(isset($v['M'])) { | |
echo '<td class="text-center">'.$v['M'].'</td>'; | |
} else { | |
echo '<td class="text-center">0</td>'; | |
} | |
if(isset($v['L'])) { | |
echo '<td class="text-center">'.$v['L'].'</td>'; | |
} else { | |
echo '<td class="text-center">0</td>'; | |
} | |
if(isset($v['XL'])) { | |
echo '<td class="text-center">'.$v['XL'].'</td>'; | |
} else { | |
echo '<td class="text-center">0</td>'; | |
} | |
if(isset($v['2XL'])) { | |
echo '<td class="text-center">'.$v['2XL'].'</td>'; | |
} else { | |
echo '<td class="text-center">0</td>'; | |
} | |
if(isset($v['3XL'])) { | |
echo '<td class="text-center">'.$v['3XL'].'</td>'; | |
} else { | |
echo '<td class="text-center">0</td>'; | |
} | |
if(isset($v['4XL'])) { | |
echo '<td class="text-center">'.$v['4XL'].'</td>'; | |
} else { | |
echo '<td class="text-center">0</td>'; | |
} | |
echo '<td class="row_count text-center" data-math="row-sum">0</td>'; | |
echo '</tr>'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment