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

Unable to fetch products names #85

Closed
jishadiocod opened this issue Jan 24, 2022 · 2 comments
Closed

Unable to fetch products names #85

jishadiocod opened this issue Jan 24, 2022 · 2 comments

Comments

@jishadiocod
Copy link

Hi,

I have been added getCandy to my Laravel Project. I can add products. When I fetch the products from my frond end HomeController its not working.

I have set en is the default language and both admin and code.

public function home(){ $products = Product::get(); return view('welcome',compact('products')); }

welcome.blade.php

{!! $item->attribute_data['name']->getValue()[App::currentLocale()] !!}

This is the only way now to get the product name. I feel there is something more easy way to get the product name. Please suggest the way to get the name of product...

@alecritson
Copy link
Collaborator

You should be able to do:

$item->translateAttribute('name');

There's some information about it in the docs https://docs.getcandy.io/getcandy/attributes.html#attributes-2

@jishadiocod
Copy link
Author

Thanks for the support. It's working....

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