[eluser]tkaw220[/eluser]
Hi Eric Barnes,
Bingo. Billion thanks to both of you. Have a nice weekend.
By the way, let me share my finding with those who had encounter this situation.
I thought I encounter error with my initial script by using print_r to inspect the resulting array:
$data = array();
foreach ($this->cart->contents() as $item)
{
$data = array(
'order_no' => $order_no,
'item' => $item['name'],
'qty' => $item['qty'],
'price' => $item['price'],
'subtotal' => $item['subtotal']
);
}
echo '<pre>';
print_r($data);
The output is the last item in the array. So I thought the previous items inside that array gone missing. In order to return proper result, add [] after the $data like this:
foreach ($this->cart->contents() as $item)
{
$data[] = array(
'order_no' => $order_no,
'item' => $item['name'],
'qty' => $item['qty'],
'price' => $item['price'],
'subtotal' => $item['subtotal']
);
}
echo '<pre>';
print_r($data);
Now it output all items inside your array.
Thank you.
Best regards,
Edwin