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

getThumbnailUrl on cart page not returning the image. #46

Closed
daniel-farina opened this issue Jun 6, 2020 · 4 comments
Closed

getThumbnailUrl on cart page not returning the image. #46

daniel-farina opened this issue Jun 6, 2020 · 4 comments
Assignees
Labels

Comments

@daniel-farina
Copy link

Hello everyone,

For some reason the following is not returning a thumbnail:

{{ $item->product->getThumbnailUrl() ?: '/images/product.jpg' }}

resources/views/cart/show.blade.php

it works fine on the product and category page with:

{{ $product->getThumbnailUrl() }}

I also tried:

  @if($item->product->hasImage())
 YES:: {{$item->product->getThumbnailUrl() }}
@else
NO IMAGE
@endif

and I can confirm it returns no image.

Is this a known issue?, I'll keep on trying to figure it out and post an update if I find anything. Any help is appreciated!

Thanks

@fulopattila122
Copy link
Member

What does $item->product->getThumbnailUrl() exactly return? NULL or some broken URL?

@fulopattila122 fulopattila122 self-assigned this Jun 7, 2020
@fulopattila122 fulopattila122 added this to In progress in Vanilo Backlog Jun 7, 2020
@daniel-farina
Copy link
Author

daniel-farina commented Jun 12, 2020

It returns the default:

<img src="/images/product.jpg" class="product-image">

i will try with a fresh installation soon to discard any changes I made first and test it on a fresh installation. I'll update this once I figure it out.

@daniel-farina
Copy link
Author

@fulopattila122
If you do the following on the CartController on the show method, does it it return false to you?

    public function show()
    {
       $item = Cart::getItems()->first();
        dd($item->product->hasImage());
        
        return view('cart.show');
    }

Mine returns false, even though the item does have images . If I run this on the ProductController I get true.

    public function show(Product $product)
    {
        dd($product->hasImage());

        return view('product.show', ['product' => $product]);
    }

@daniel-farina
Copy link
Author

We can close this ticket. The problem was the incorrect model information in the database after implementing a custom Product model.

Thank you!

@fulopattila122 fulopattila122 moved this from In progress to Done in Vanilo Backlog Feb 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

No branches or pull requests

2 participants