Reputation: 3317
Having some real problems with this and hoping someone can help. Here's a reduced sample of the data I'm working with. So here $order_info is an array, inside that array theres another array called $items and within that there's multiple arrays which have the item ID as a name (very annoying!). What I'm trying to do is loop through the arrays within the $items array - the problem is I won't know their name. Is it possible to just loop through every array within an array (which is also within an array!)? It also needs to use smarty. I've tried various nested for loops but all have just come back with a blank page, suggesting an error.
{$order_info} Array (86)
order_id => "15"
items => Array (2)
4008222099 => Array (19)
item_id => "4008222099"
order_id => "15"
product_id => "836"
product_code => "B0001WS6L2"
price => "229.95"
amount => "1"
extra => Array (9)
step => "1"
product_options => Array (0)
unlimited_download => "N"
product => "LINGO TR-2203 Pacifica Talk Talking T..."
company_id => "0"
is_edp => "N"
edp_shipping => "N"
base_price => "229.95"
stored_price => "N"
product => "LINGO TR-2203 Pacifica Talk Talking T..."
deleted_product => ""
discount => "0"
company_id => "0"
base_price => "229.95"
original_price => "229.95"
cart_id => "4008222099"
tax_value => "0"
subtotal => "229.95"
display_subtotal => "229.95"
shipped_amount => "0"
shipment_amount => "1"
1157311813 => Array (19)
item_id => "1157311813"
order_id => "15"
product_id => "744"
product_code => "B00028DM96"
price => "119.99"
amount => "1"
extra => Array (9)
step => "1"
product_options => Array (0)
unlimited_download => "N"
product => "Sharp Electronics PW-E550 Electronic ..."
company_id => "0"
is_edp => "N"
edp_shipping => "N"
base_price => "119.99"
stored_price => "N"
product => "Sharp Electronics PW-E550 Electronic ..."
deleted_product => ""
discount => "0"
company_id => "0"
base_price => "119.99"
original_price => "119.99"
cart_id => "1157311813"
tax_value => "0"
subtotal => "119.99"
display_subtotal => "119.99"
shipped_amount => "0"
shipment_amount => "1"
Upvotes: 0
Views: 820
Reputation: 3317
The following solved it - should help if people need to do the same in the future:
{foreach from=$order_info.items item=foo}
{$foo.product_id}
{/foreach}
Upvotes: 1