Closed byordereurope closed 11 years ago
I had similar problem when trying to update cart through ajax request. I found out that the issue was with the cookie generated. By default, it creates cookies to be path specific. I changed line ~46 in Cookie.php (regenerate method) to be the one below and that will set the cookie to root level.
setcookie('cart_identifier', $identifier, 0, "/");
Seems after a new request not any of the Cart::method() seems to be working. However when i dump sessions then i see cart value in there.
@foreach( Cart::contents(true) as $item ) {{ print_r($item) }} @endforeach
Does nothing, should output all the contents
@if(Cart::totalItems())
{{ Cart::totalItems() }} in cart
@endif
Does nothing either. Keep in mind this is blade syntax, however the package seems not to work.
This is however the output from sessions
Array ( [_sf2_attributes] => Array ( [_token] => 27TqPweZAfKCtYCEhMZlP6YSYCKi1R1iLlLByeFM [cart] => Array ( [10a60423601f1e90ec6721796e3a1932] => Array ( ) [15a28e729264ee3f3050c238bea1311a] => Array ( [8a48aa7c8e5202841ddaf767bb4d10da] => Moltin\Cart\Item Object ( [identifier:protected] => 8a48aa7c8e5202841ddaf767bb4d10da [store:protected] => Moltin\Cart\Storage\LaravelSession Object ( [identifier:protected] => [id] => 15a28e729264ee3f3050c238bea1311a ) [tax:protected] => Moltin\Tax\Tax Object ( [percentage:protected] => 0 [deductModifier:protected] => 1 [addModifier:protected] => 1 ) [data:protected] => Array ( [id] => 6 [name] => Battery - Lithium CR2025 [price] => 1 [quantity] => 3 ) ) ) ) [flash] => Array ( [old] => Array ( ) [new] => Array ( ) ) ) [_sf2_flashes] => Array ( ) [_sf2_meta] => Array ( [u] => 1375124033 [c] => 1375121483 [l] => 7200 ) ) 1
So the content is definately there.