Hi! I have a challenge on indexing and creating a view of products (i'm using Drupal Commerce).
I have node content type called "Product display" which works as a wrapper of products variations (different colors and sizes). The node itself doesn't contain that much information about products so I actually index the title field only. The node type contains a field of unlimited product references.
The reason why I don't index directly the commerce products, is the fact that I want to display nodes only instead commerce products. This is because I can't set a relationship between commerce products and node products backwards (reverse reference).
When setting up my node products search index, I can see "Product references" fields available which is great, but when trying to add related fields of product references, I can see only these fields: Product ID, SKU, Type, Title, Date created, Date updated, Creator ID, Creator.
Why there is no other fields available? It seems that fields which comes already with commerce product are included but not the ones I've created myself such as "Size", "Weight" and "Colors"...
I'm not sure, is this a feature request or a bug since I'm not sure how it's suppose to work. Feel free to change..
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | 1214862--add-all-fields-for-nested-entities.patch | 1.36 KB | drunken monkey |
| Screenshot of available fields | 38.04 KB | imiksu |
Comments
Comment #1
drunken monkeyThat's actually a feature request for the Entity API, or at least it would better be solved there. The problem is that the products probably use bundles – and when fields are only added to bundles, not to the whole entity type, Entity API won't return them at the moment.
See #1214974: Provide a way for the wrapper to alter the property info of referenced entities.
The problem was also already discussed in #1138196: Fields from referenced entities not included in fields list.
Comment #2
drunken monkeyTogether with the patch in #1214974-7: Provide a way for the wrapper to alter the property info of referenced entities, this should solve the issue. Please try it out!
Comment #3
zambrey commentedWorks fine, great work. Thank you very much.
Comment #4
drunken monkeyThanks for the fast review! Committed.
Comment #5
imiksuJust tested it out and works great! Thanks for fast respond!