I am trying to get the item id, and then all option_name/option_values within that item id. So I end up with, ID: 123, Color: Blue, Size: 6. ID: 456, Color: Yellow, Size: 8. However I am getting the correct item ID, but the option_name/option_value isn't coming through correctly, either blank or just one random letter.
Here's my code that doesn't work,
foreach($itemlist as $item)
{
echo $item['ID'];
foreach($item as $option)
{
echo $option['option_name'];
echo $option['option_value'];
}
}
Where $itemlist
looks like this:
Array ( [1] => Array ( [ID] => 123 [QTY] => 1 [MODEL] => sdfsd [IMAGE] => [1] => Array ( [option_name] => Color [option_value] => Blue [option_price] => 0.0000 ) [2] => Array ( [option_name] => Size [option_value] => 6 [option_price] => 0.0000 ) [price] => 0 ) [2] => Array ( [ID] => 456 [QTY] => 0 [MODEL] => gsdfgd [IMAGE] => [1] => Array ( [option_name] => Color [option_value] => Yellow [option_price] => 0.0000 ) [2] => Array ( [option_name] => Size [option_value] => 8 [option_price] => 0.0000 ) [price] => 0 ) )See Question&Answers more detail:os