cancel
Showing results for 
Search instead for 
Did you mean: 

Custom attribute not appearing (inconsistent behaviour on two servers)

SOLVED

Custom attribute not appearing (inconsistent behaviour on two servers)

Hi

 

I have to servers running the same block code / template, which outputs a custom product attribute. In both admins I see that the attribute has a value (/p/r/something.png)

I use the following code for debugging:

$attrImage = $_product->getData('product_slider_image');
echo 'product_slider_image: ' . $attrImage . '<br/>';

On server 1 I get the data as expected, on server 2 I get an empty string.

Tried clearing both cache and index without any change.

What may cause this?

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Custom attribute not appearing (inconsistent behaviour on two servers)

Ah, found the issue. The issue was that "Use in product listing" was not set for the attribute. But in 2.1.8, there is no way of setting this from the admin for image attributes, since the admin CSS hides the setting. But I remembered I did a fix for this on the other server a few weeks ago.

The "Storefront Properties" tab for the attribute is still in the DOM, so I inspected the element and removed the "display: none" setting. Then I was able to check the "Used in product listing" setting and everything works as expected.

View solution in original post

3 REPLIES 3

Re: Custom attribute not appearing (inconsistent behaviour on two servers)

Both servers run 2.1.8

Re: Custom attribute not appearing (inconsistent behaviour on two servers)

I even tried adding a new custom attribute. Same issue as above. No value is outputted on one of the servers.

Re: Custom attribute not appearing (inconsistent behaviour on two servers)

Ah, found the issue. The issue was that "Use in product listing" was not set for the attribute. But in 2.1.8, there is no way of setting this from the admin for image attributes, since the admin CSS hides the setting. But I remembered I did a fix for this on the other server a few weeks ago.

The "Storefront Properties" tab for the attribute is still in the DOM, so I inspected the element and removed the "display: none" setting. Then I was able to check the "Used in product listing" setting and everything works as expected.