Greetings,

This works in Commerce Kickstart but not using this module on it's own. I have created a view type using Product DIisplay index. By default the format is rendered and image and everything is else displayed OK. However, I need to use fields. So I added a relationship field_product and i am then able to get the data for all fields from the product entity bundle except images and price. I have tested this on multiple installations and the same issue occurs. Since the images appear in the rendered format I assume this is not a problem with search api. Any help would be appreciated. Thanks Kevin

Comments

rszrama’s picture

Project: Commerce Core » Commerce Search API
Version: 7.x-1.8 » 7.x-1.x-dev
Component: Views integration » Code
Category: Bug report » Support request

I couldn't tell ya, but it's not a bug in Commerce itself if it's working fine in Kickstart. Maybe someone in the Commerce Search API queue can provide some insight into using the module on its own.

pyxio’s picture

Thanks for the reply Ryan, can you please test this yourself and see if you experience the same issue? It would be appreciated in order for me to try to troubleshoot what is a very critical issue in my opinion. Thanks

rszrama’s picture

Sorry, I don't really have any experience w/ Search API personally; you might try finding joshmiller in the #drupal-commerce IRC room.

jazzdrive3’s picture

Project: Commerce Search API » Search API
Component: Code » Views integration

Getting the same issue. It's like the relationship to the Product in the view doesn't work at all.

Price, images, anything is just blank. The label works, but not the actual content.

It's not related directly the Commerce Search API either, but to Search API and Search API Views. Unless there is something special that has to be done regarding the product reference relationship on the Commerce side.

jazzdrive3’s picture

Category: Support request » Bug report
jazzdrive3’s picture

Entity Reference field relationships work, and allow me to bring in entity fields on Search API views.

But not the Product reference relationship. However, the Product reference relationship works fine in regular views, of course. So there is some disconnect.

Here's another weird thing: if I try to rewrite the output of a product field pulled in by the relationship, it still prints nothing. I just try to replace it with arbitrary text, and it still does nothing. Its like its missing the render function completely.

jazzdrive3’s picture

Project: Search API » Commerce Core

So this use case actually does not work in Commerce Kickstart either. Just change the view from a rendered entity to a view of fields, and you'll see what I mean. No product fields are ever rendered, even with the relationship. As I said before, this use case works as expected if you use the entity reference module to pull in fields from other entities, as I have that working on another site.

I'm beginning to think this actually is a Commerce issue, but specifically with the product reference field type and its Views integration. I can't see anything that jumps out at me, however.

rszrama’s picture

Category: Bug report » Support request
Status: Active » Postponed (maintainer needs more info)

I suppose we'll need some steps in here to exactly reproduce the issue. Have you tested on the latest -dev by any chance? And are we sure it isn't product access control getting in the way?

jazzdrive3’s picture

I have all the permissions open for products, bypassed access on the query settings for the view, and I'm logged in as the root drupal user. I don't think its a permissions issue.

1. Create a product display index (or use the one from Commerce Search API)
2. Create a view on that search index of type.
3. Set the View Format to HTML List, and set the row settings to show "Fields".
4. Create a relationship on the indexed product reference field.
5. Add any product related fields to the Fields. I added price and an attached image field.
6. These fields are never rendered, not even in the preview. Even if you rewrite them to just print out arbitrary plain text, nothing is printed. Its like they are bypassing the rendering completely. The labels of the field work fine.

The product display, node-specific fields work just fine as well.

I can actually search by the product fields (searching a specific SKU works well and pulls up the right results) but I can't render that SKU through the product reference relationship.

As mentioned above, if I do the same thing, but with an entityreference field, the related fields are pulled in and display as expected.

pyxio’s picture

jazzdrive3,

yes, you are right. the interesting thing though that it works in Commerce Kickstart. So there is something with the CK configuration that fixes this issue. perhaps somebody more technically skilled than me can figure out why. To test this spin up a CK distro on pantheon and try the same process as above. I am very curious to hear about your findings. I did not create a new view, i just used the product display view they already have their and modified it to use fields instead of rendered entity. change the view to fields format... delete the automatically added rendered node field... then set the product relationship and try adding image and price. they work. i am perplexed.

jazzdrive3’s picture

drupalstrap,

I just tested it in a brand new Commerce Kickstart installation, and began getting the exact same issues.

In the default install, it uses the fully rendered entity as the row style. And it works. But change it to "Fields", and none of the product fields are rendered.

What version of Commerce Kickstart is Pantheon installing?

jazzdrive3’s picture

Looks like pantheon is using the latest Kickstart package. Weird. Did you install it with or without the test store data? I did mine WITH the test store data.

pyxio’s picture

StatusFileSize
new76.38 KB
new121.58 KB

It works for me with Kickstart using Commerce version 7.x-1.8. And it works for me on Pantheon Kickstart 7.x-1.8. I am using the view called Collection Products.

It does not work on my local box using Commerce version 7.x-1.8 without Kickstart. See images of my view output on pantheon attached

asauterChicago’s picture

Anyone get anywhere with this? I thought it was just a bug with my view, but same issue, it won't render anything from the commerce product, except for the checkout button.

pyxio’s picture

Unfortunately, no progress. Commerce does not appear to work with search api indexed node views fields. The only alternative is to theme the product display node template :o(

lchang’s picture

Hi,

I submitted a patch to the Entity API.

You can try it.

Regards!

pyxio’s picture

Hi Ichang,

I tried you patch and it still does not work. I see the product label but no images. Thanks for your effort on this issue.! Cheers Kevin

lchang’s picture

Hi, Kevin

Could you show your views settings?

pyxio’s picture

StatusFileSize
new32.95 KB
new168.79 KB

Hi. I am uploading the screenshots. Let me know if you want view export. Thanks

lchang’s picture

The following is my views:

$view = new view();
$view->name = 'a';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'search_api_index_product_display';
$view->human_name = 'a';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['title'] = 'a';
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['access']['type'] = 'none';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['pager']['options']['items_per_page'] = '10';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'fields';
/* Relationship: Indexed Node: Product */
$handler->display->display_options['relationships']['field_product']['id'] = 'field_product';
$handler->display->display_options['relationships']['field_product']['table'] = 'search_api_index_product_display';
$handler->display->display_options['relationships']['field_product']['field'] = 'field_product';
/* Field: Commerce Product: Images */
$handler->display->display_options['fields']['field_images']['id'] = 'field_images';
$handler->display->display_options['fields']['field_images']['table'] = 'entity_commerce_product';
$handler->display->display_options['fields']['field_images']['field'] = 'field_images';
$handler->display->display_options['fields']['field_images']['relationship'] = 'field_product';
$handler->display->display_options['fields']['field_images']['click_sort_column'] = 'fid';
$handler->display->display_options['fields']['field_images']['settings'] = array(
  'image_style' => 'thumbnail',
  'image_link' => '',
);
$handler->display->display_options['fields']['field_images']['delta_offset'] = '0';

/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page');
$handler->display->display_options['path'] = 'a';

I created a search index: product_display, so the $view->base_table = 'search_api_index_product_display';
The path of page is "/a".

BTW, I used the Git to clone the dev version of Entity API and applied my patch.

pyxio’s picture

i will update entity to dev version... i will delete my view and import yours... then i will report back if it works. thanks again for your help on this issue.

pyxio’s picture

OK. So I updated to entity 7.x-1.5 and it works! But I this module update overwrote your patch and it still works. so is your patch needed? Or does it work without it??? Thanks so much!!

lchang’s picture

If you don't apply the patch, you may also see images.
The trick is that If there are Product displays without referencing any product, all images may be disappeared again.
This situation does not always occur, it depends the order of the product display, if the empty product display is the last one rendered by views, all images will be disappeared.

pyxio’s picture

Thanks Ichang... so whether I need the patch or not, you saved my life ;o) We will see if my situation requires it, if so it is great to know that now this seriously problematic situation seems to be resolved. Cheers Kevin

lchang’s picture

StatusFileSize
new4.8 KB

You're welcome!

If you want to see the problem, you can do:

  1. Do not apply the patch.
  2. Create this SORT CRITERIA:
    SORT CRITERIA
  3. Create a new empty Product display(don't reference any product).
asauterChicago’s picture

Upgrading to Entity 7.x-1.5 worked for me as well. Thank you for getting back on this, I was stuck on this issue for a while.

Anonymous’s picture

Will Someone please let me know how to search product display in search box by using Search API/Commerce Search except apache solr.

Robert_W’s picture

I have this issue as well. I'm using Entity API 1.6 and I only see the price and images rendered as fields when ALL products have images, as soon as one is empty I see nothing. This a problem for me because I include search results from other content types as well (regular pages), so basically I never see the images and prices of products.

I tried debugging myself, but could not find anything that works. Does somebody know how to fix this or in which direction I should be looking for a fix?

Robert_W’s picture

Status: Postponed (maintainer needs more info) » Active
robbertnl’s picture

https://www.drupal.org/node/2239709 fixed this issue for me

ronino’s picture

This sounds indeed like #2239709: EntityFieldHandlerHelper::extract_property_multiple returns a wrong type of the extracted wrappers. I had a similar case where no images at all were displayed if the last row in the view had none. So if this is the case for you, you might want to test the fixes from the related issue.