[eluser]WanWizard[/eluser]
The key is generated internally in the Cart class.
Every unique combination of $data_barang['id'] and $data_barang['options'] will generate a unique key, and therefore a new row in the list of cart items.
So
Code:
$data_barang = array(
'id' => $c['id_barang'],
'qty' => $c['jumlah'],
'price' => 1,
'name' => $c['namabarang'],
'jenis_penjualan' => $c['id_penjualan'],
'options' => array('kode' => $c['kodebarang'])
);
and
Code:
$data_barang = array(
'id' => $c['id_barang'],
'qty' => $c['jumlah'],
'price' => 1,
'name' => $c['namabarang'],
'jenis_penjualan' => $c['id_penjualan'],
'options' => array('kode' => $c['kodebarang'], 'discount' => 'Free bonus item')
);
are two different items in the cart.