Open blenderdeluxe opened 8 years ago
Could you please give me a little smaller example of how I can reproduce this problem? Given a new Laravel installation.
Hi,
If you want to update the cart for the instance 'reservations'
you have to use the below code
$item = Cart::instance('reservations')->get($rowId);
Instead of
$item = Cart::instance('courses')->get($rowId);
Thanks.
good afternoon, I ask for your help, perform the implementation of laravelshoppingcart, the products are added but they are not shown throws the following error, I do not see the fault, thanks Trying to get property 'slug' of non-object (View: C: \ xampp \ htdocs \ ecommerce \ ecommerce \ resources \ views \ cart.blade.php), I go to cart.blade.php view
<! - end cart-table ->@leydijo If you encounter a 'Trying to get property XY of non-object in ...' It is usually due that the object that should hold the propery has not been instantiated (i.e. is null or any other type than object). Do you have a reference to ->slug in your cart.blade.php? But remember, without knowing more about your integration i can only make guesses.
Also you could add three ` before and after your code in order to properly format it.
Hi everyone I have a problem with update cart instance I have two instance
All it is fine but when I try to update a item in instance reservations this return exception The cart does not contain rowId 9e6f03ab1c6bb1227b92db5a945c817d.
But I go to Cart.php in vendor folder nand in line 181 in the function get() I modify for know what happend here so I add a dd() for show actual rowId that I send in Ajax and know if this use the correct instance (courses and NOT reservations)
And in the inspector this return (I used ajax for update item qty) the instance is correct (reservations) and the rowId the I get from Ajax exist in the content of the instance
"bd8524f8195d365217ffd17b14ec7415{"6b9b3641ee84da514e000d305e606843":{"rowId":"6b9b3641ee84da514e000d305e606843","id":1,"name":"Open Water Diver","qty":0,"price":260000,"options":{"description":"Aprende a bucear con equipo scuba y obt\u00e9n una licencia, para bucear sin problemas por el mundo entero.","icon":"icon-open-water-diver"},"tax":0,"subtotal":0},"5e2690d03b39c8122d6febbd4b293ab7":{"rowId":"5e2690d03b39c8122d6febbd4b293ab7","id":2,"name":"Advanced Open Water Diver","qty":0,"price":240000,"options":{"description":"Este curso te ayuda a incrementar la con\ufb01anza, tambi\u00e9n podr\u00e1s desarrollar tus destrezas y t\u00e9cnicas de buceo para que puedas sentirte m\u00e1s c\u00f3modo y h\u00e1bil en el agua.","icon":"icon-advanced-open-water-diver"},"tax":0,"subtotal":0},"bd8524f8195d365217ffd17b14ec7415":{"rowId":"bd8524f8195d365217ffd17b14ec7415","id":4,"name":"Rescue Diver","qty":0,"price":250000,"options":{"description":"Aprender\u00e1s t\u00e9cnicas de rescate en el agua. Partiendo de lo que ya haz aprendido al bucear, este curso ampl\u00eda los conocimientos que ya tienes acerca de como prevenir problemas y como gestionarlos si suceden.","icon":"icon-rescue-diver"},"tax":0,"subtotal":0}}"
If you see
exist here
{"rowId":"bd8524f8195d365217ffd17b14ec7415","id":4,"name":"Rescue Diver","qty":0,"price":250000,"options":{"description":"Aprender\u00e1s t\u00e9cnicas de rescate en el agua. Partiendo de lo que ya haz aprendido al bucear, este curso ampl\u00eda los conocimientos que ya tienes acerca de como prevenir problemas y como gestionarlos si suceden.","icon":"icon-rescue-diver"},"tax":0,"subtotal":0}}"
and if I use in my controller
of course without dd($rowId.$content); in get function I get perfectly the item
If I delete dd($item); here this return Exception
InvalidRowIDException in Cart.php line 187: The cart does not contain rowId bd8524f8195d365217ffd17b14ec7415.
Aps and if you see that the quantity of items is 0, this is correct because I modified before because I have defaults items and I dont need add items dynamic
I commented the line 145
$this->remove($cartItem->rowId);
and after
I modified the line 181
if(empty($qty) || ! is_numeric($qty))
by
if(! is_numeric($qty))
This modifications dont have problems and works fine :D, is only for that you understand Why I use qty 0 in the items.
Hope can help me with this update item