I have an application using PHP CodeIgniter's Cart library. And I need this output, to send info to google analytics:
$itemsga = array(
array('sku'=>'SDFSDF', 'name'=>'Shoes', 'category'=>'Footwear', 'price'=>'100', 'quantity'=>'1'),
array('sku'=>'123DSW', 'name'=>'Sandles', 'category'=>'Footwear', 'price'=>'87', 'quantity'=>'1'),
array('sku'=>'UHDF93', 'name'=>'Socks', 'category'=>'Footwear', 'price'=>'5.99', 'quantity'=>'2')
);
To achieve that, I created this code:
$itemsga = array(
foreach ($this->cart->contents() as $items){
array(
'sku' => $items['id'],
'name' => $items['name'],
'price' => $items['price'],
'quantity' => $items['qty'],
),
}//endforeach
);
For some reason I'm getting a white screen. No error displayed but my array is not being built.
I know this might be a stupid question, but I got stuck. Can someone help me?
Cheers!