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..

Comments

drunken monkey’s picture

That'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.

drunken monkey’s picture

Status: Active » Needs review
StatusFileSize
new1.36 KB

Together 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!

zambrey’s picture

Works fine, great work. Thank you very much.

drunken monkey’s picture

Status: Needs review » Fixed
Issue tags: -fields, -indexing, -commerce

Thanks for the fast review! Committed.

imiksu’s picture

Just tested it out and works great! Thanks for fast respond!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.