{"action":"created","issue":{"url":"https://api.github.com/repos/darryldecode/laravelshoppingcart/issues/43","labels_url":"https://api.github.com/repos/darryldecode/laravelshoppingcart/issues/43/labels{/name}","comments_url":"https://api.github.com/repos/darryldecode/laravelshoppingcart/issues/43/comments","events_url":"https://api.github.com/repos/darryldecode/laravelshoppingcart/issues/43/events","html_url":"https://github.com/darryldecode/laravelshoppingcart/issues/43","id":121693236,"number":43,"title":"Cart::getTotal() in view","user":{"login":"subdesign","id":691695,"avatar_url":"https://avatars.githubusercontent.com/u/691695?v=3","gravatar_id":"","url":"https://api.github.com/users/subdesign","html_url":"https://github.com/subdesign","followers_url":"https://api.github.com/users/subdesign/followers","following_url":"https://api.github.com/users/subdesign/following{/other_user}","gists_url":"https://api.github.com/users/subdesign/gists{/gist_id}","starred_url":"https://api.github.com/users/subdesign/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/subdesign/subscriptions","organizations_url":"https://api.github.com/users/subdesign/orgs","repos_url":"https://api.github.com/users/subdesign/repos","events_url":"https://api.github.com/users/subdesign/events{/privacy}","received_events_url":"https://api.github.com/users/subdesign/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-12-11T11:43:16Z","updated_at":"2015-12-11T15:52:57Z","closed_at":null,"body":"When I want to echo out the total value in the view, I get the following error:\r\n```php\r\nErrorException\r\nTrying to get property of non-object.. {view file name}\r\n/­vendor/­darryldecode/­cart/­src/­Darryldecode/­Cart/­Cart.php510\r\nLine: $originalPrice = $item->price;\r\n```\r\nOf course I have some items in the cart, and all items have price set.\r\n\r\n```php\r\nCartCollection {#401 ▼\r\n  #items: array:2 [▼\r\n    21 => array:6 [▼\r\n      \"quantity\" => 6\r\n      \"id\" => \"21\"\r\n      \"name\" => \"******************\"\r\n      \"price\" => 7800.0\r\n      \"attributes\" => ItemAttributeCollection {#341 ▶}\r\n      \"conditions\" => []\r\n    ]\r\n    31 => array:6 [▼\r\n      \"quantity\" => 6\r\n      \"id\" => \"31\"\r\n      \"name\" => \"**************\"\r\n      \"price\" => 1.0\r\n      \"attributes\" => ItemAttributeCollection {#342 ▶}\r\n      \"conditions\" => []\r\n    ]\r\n  ]\r\n}\r\n```\r\nEDIT: its not always, when I clear the cart, no error happens. It's something with adding to the cart...\r\n\r\nEDIT 2: some way one of my item differs from others:\r\n```\r\nCartCollection {#386 ▼\r\n  #items: array:2 [▼\r\n    21 => ItemCollection {#341 ▶}\r\n    31 => array:6 [▶]\r\n  ]\r\n}\r\n```\r\nthis is why error happens.. any idea?\r\n\r\nEDIT 3:\r\nWhen I constantly add, remove items to the cart, sometimes one of the items randomly will be saved as array, and not as ItemCollection. Of course I use the same code all the way..\r\n```\r\nCartCollection {#435 ▼\r\n  #items: array:4 [▼\r\n    21 => ItemCollection {#341 ▶}\r\n    27 => ItemCollection {#343 ▶}\r\n    22 => ItemCollection {#345 ▶}\r\n    20 => array:6 [▶]\r\n  ]\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/darryldecode/laravelshoppingcart/issues/comments/163971576","html_url":"https://github.com/darryldecode/laravelshoppingcart/issues/43#issuecomment-163971576","issue_url":"https://api.github.com/repos/darryldecode/laravelshoppingcart/issues/43","id":163971576,"user":{"login":"subdesign","id":691695,"avatar_url":"https://avatars.githubusercontent.com/u/691695?v=3","gravatar_id":"","url":"https://api.github.com/users/subdesign","html_url":"https://github.com/subdesign","followers_url":"https://api.github.com/users/subdesign/followers","following_url":"https://api.github.com/users/subdesign/following{/other_user}","gists_url":"https://api.github.com/users/subdesign/gists{/gist_id}","starred_url":"https://api.github.com/users/subdesign/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/subdesign/subscriptions","organizations_url":"https://api.github.com/users/subdesign/orgs","repos_url":"https://api.github.com/users/subdesign/repos","events_url":"https://api.github.com/users/subdesign/events{/privacy}","received_events_url":"https://api.github.com/users/subdesign/received_events","type":"User","site_admin":false},"created_at":"2015-12-11T15:52:57Z","updated_at":"2015-12-11T15:52:57Z","body":"Currently no idea what happens, I do things the way I read in the docs. Maybe the ajax calls can disturb some way the code? \r\nI'll investigate the code step by step soon. If you have idea what/how to debug in this case I appreciate it!"}}