Is there a way to get a specified array inside codeigniter's cart session?
for example i have these values
Array
(
[c81e728d9d4c2f636f067f89cc14862c] => Array
(
[rowid] => c81e728d9d4c2f636f067f89cc14862c
[id] => 2
[qty] => 1
[price] => 1000
[name] => Pin
[subtotal] => 1000
)
[c4ca4238a0b923820dcc509a6f75849b] => Array
(
[rowid] => c4ca4238a0b923820dcc509a6f75849b
[id] => 1
[qty] => 3
[price] => 100
[name] => Amber
[subtotal] => 300
)
)
and i only want to get the values for the array "c4ca4238a0b923820dcc509a6f75849b"
i tried
$this->session->userdata("c81e728d9d4c2f636f067f89cc14862c");
and
$this->cart->contents("c81e728d9d4c2f636f067f89cc14862c");
but it didnt work
you can get your cart items with $this->cart->contents()
to get a specific key, just call like this.
$getCartItem = 'c4ca4238a0b923820dcc509a6f75849b';
$cartItems = $this->cart->contents();
if( isset($cartItems[$getCartItem]) )
{
$item = $cartItems[$getCartItem];
// do stuff
} else {
//not found
}