Cart ID - Undefined index ID
carstengrimm opened this issue · comments
I am trying to use this class to implement into my shopping cart and according to the examples i am creating entries in my cart and i am trying to use a non-numeric value as 'id' and then later call it in my cart
$cart->add('hash123',1, [
'image' =>'some-jpg-123.jpg'
]);
// later
foreach(c::get('cart')->getItems() as $items):
foreach($items as $cart):
<a href="/thumbs/<?php echo byHash($cart['id']) ?>/<?php echo $cart['attributes']['image'] ?>">....</a>
endforeach;
endforeach;
when outputting the raw data, it doesn't have any sort of "id" index... output is for example:
Array
(
[1lgw886] => Array
(
[0] => Array
(
[quantity] => 1
[hash] => 8fdd062086410a3f8cc5552c3c4f9363
[attributes] => Array
(
[image] => studio-black-2017-18-41-00.jpg
)
)
)
)
My mistake, the "id" attribute has been added.