Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to get property 'image' of non-object #108

Open
junmingyeo opened this issue Mar 18, 2021 · 1 comment
Open

Trying to get property 'image' of non-object #108

junmingyeo opened this issue Mar 18, 2021 · 1 comment

Comments

@junmingyeo
Copy link

Hi, I am currently facing an issue where I click proceed to checkout using a user account that are not in my first entry in the user table. I am unable to load the checkout page and with an error message " Trying to get property 'image' of non-object".

When I use guest checkout or the user account of the first entry of my user table, I have no such issues and I am able to do my checkout and all.

Does anyone have any idea what is causing this?

@blwsh
Copy link

blwsh commented Mar 29, 2021

Could be something to do with

<div class="checkout-table">
@foreach (Cart::content() as $item)
<div class="checkout-table-row">
<div class="checkout-table-row-left">
<img src="{{ productImage($item->model->image) }}" alt="item" class="checkout-table-img">
<div class="checkout-item-details">
<div class="checkout-table-item">{{ $item->model->name }}</div>
<div class="checkout-table-description">{{ $item->model->details }}</div>
<div class="checkout-table-price">{{ $item->model->presentPrice() }}</div>
</div>
</div> <!-- end checkout-table -->
<div class="checkout-table-row-right">
<div class="checkout-table-quantity">{{ $item->qty }}</div>
</div>
</div> <!-- end checkout-table-row -->
@endforeach

Maybe try wrapping checkout-table-row in:

@if($item->model)
...
@endif

If this fixes your problem there's likely still an underlying issue such as a missing foreign key.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants