Back to Catalog Support

igorblumberg
igorblumberg

Hello, I'm trying to output a product custom field value but nothing appears. On the template I have:

{{product.partner_url}}

I've dug into the source code and fixed it. In the file tiipiik/catalog/components/ProductDetails.php In the method loadProduct (line 50) we have:

if (isset($product->customfields))

This is always returning false. I fixed it by checking if the collection is empty or not, using the "isEmpty" method of the Laravel's Collection class:

if(!$product->customfields->isEmpty())

Everything works.

Is there any other way to fix it without changed the plugin code?

thanks

Last updated

igorblumberg
igorblumberg

Just a fix of the fix.

if(isset($product) && !$product->customfields->isEmpty())

the first isset is important so we don't raise an exception when the product slug doesn't exist

Tiipiik
Tiipiik

Same as for your other post, last udpate should resolve that.

Thanks.

1-3 of 3