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

Product attribute not always showing up on category page #3199

Closed
juho-jaakkola opened this issue Jul 9, 2019 · 6 comments
Closed

Product attribute not always showing up on category page #3199

juho-jaakkola opened this issue Jul 9, 2019 · 6 comments
Labels
M: takes some effort Smaller new feature of rewrite of existing code, takes multiple hours question If you are not sure how sth works or want discuss someting

Comments

@juho-jaakkola
Copy link

I have a custom dropdown product attribute called delivery_time.

I am using this helper method: https://github.com/DivanteLtd/vue-storefront/blob/master/core/modules/catalog/helpers/optionLabel.ts to display the selected attribute option within each product tile on the category page.

However, something strange happens on the page. On the first page load I do not see the attribute value at all:

Screenshot 2019-07-09 at 10 34 14 AM

After I click the filters a couple of times, the attribute appears, but only the ID of the value is displayed:

Screenshot 2019-07-09 at 10 35 13 AM

When I visit the product detail page, and come back to the category page, the value label is finally displayed as expected:

Screenshot 2019-07-09 at 10 39 53 AM

I have tried adding the delivery_time attribute in config/local.json to these sections:

  • entities.productList.includeFields
  • entities.productListWithChildren.includeFields

I have also tried whether the frontend visibility settings of the attribute within Magento 2 admin panel could affect this.

But none of these have any effect on the visibility of the attribute id nor its label.

Am I missing something, or what could explain this weird behavior?

@juho-jaakkola juho-jaakkola added the question If you are not sure how sth works or want discuss someting label Jul 9, 2019
@juho-jaakkola
Copy link
Author

In my example I am using a custom theme, but I tested the same attribute also with the theme-default to make sure nothing has accidentally been broken within the theme.

@pkarw pkarw added the M: takes some effort Smaller new feature of rewrite of existing code, takes multiple hours label Jul 9, 2019
@juho-jaakkola
Copy link
Author

The "takes some effort" label was added? What exactly is causing the described problem?

@pkarw
Copy link
Collaborator

pkarw commented Jul 10, 2019

@juho-jaakkola i've just added a label to set the weight of this task in Github Issues, haven't had a chance to take a deeper tech look

@juho-jaakkola
Copy link
Author

juho-jaakkola commented Jul 10, 2019

I added another attribute that has a simple integer value. That one appears on the category page as expected as long as I have added it into the entities.productList.includeFields array in config/local.json.

So could there be some problem specifically with attributes having multiple options?

@pkarw
Copy link
Collaborator

pkarw commented Jul 11, 2019

Hi there, for sure the attribute needs to be on the entities.productList and entities.productListWithChildren included. If it's not the int or text attribute (say: multivalue) it won't be automatically labeled across the attribute entities meta data. If it's simple attribute and it's integer and you're using optionLabel it should be displayed properly as long as you've got the attribute data loaded for this attribute.

category pages loads the attribute metadata for the attributes that are listed in the config.products.defaultFilters - so you can put this attribute in there in order to have it metadata listed properly or call the attribute/list manually

@juho-jaakkola
Copy link
Author

The problem about the attribute labels should indeed get fixed once the issue #3220 gets fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
M: takes some effort Smaller new feature of rewrite of existing code, takes multiple hours question If you are not sure how sth works or want discuss someting
Projects
None yet
Development

No branches or pull requests

2 participants