This is a great Module. I thought I'd start off with that.
I have Search API module installed and I'm able to create Views based off of the Search Indexes I've made.
When I try and add any Global PHP field to one of these Search Index views, the results are blank. the individual fields I enter in the View appear fine, it's just the PHP field that's blank.
When I add something like
<?php
print '<pre>';
print_r($row);
print '</pre>';
?>
in the Global PHP field, I get this returned:
stdClass Object
(
[title] =>
[php] =>
[price] =>
[author] =>
[uc_product_image] =>
[body] =>
[taxonomy_catalog] =>
[field_rating] =>
[nid] =>
)
The Global PHP fields work great when I create a standard View.
Comments
Comment #1
doors CreditAttribution: doors commentedI am having the same problem with my Search API view.
Can anyone help?
Comment #2
ntfreddy CreditAttribution: ntfreddy commentedI have a work around for this problem. replace the line 214 in the file
views_php/plugins/views/views_php_handler_field.inc
Replace the line :
by :
When using search api index entities you have to make sure the Global:php field is arranged below the fields it uses, otherwise the all referenced field will be empty.
This is good :
This is bad :
Comment #3
tobyj CreditAttribution: tobyj commentedThanks fidomou - your solution worked for me.
Comment #4
bryanzera CreditAttribution: bryanzera commentedSubscribing: Experiencing the same issue with Search API v 7.x-1.7. @ntfreddy's fix unfortunately does not work for me. The output for the Views PHP field is always empty, but other fields work just fine. The Views PHP field's label and rewriting works fine. If I add "No Results" text, that is what displays on every field. The "No Results" text can be rewritten with tokens.
Comment #5
MilosL CreditAttribution: MilosL commented@ntfreddy's: Many thanks, it works (Search API 7.x-1.8, Views PHP 7.x-1.x-dev)
@bryanzera: Are you sure that you have replaced code at line 214?
Comment #6
tomrenner CreditAttribution: tomrenner commentedHacking views_php_handler_field.inc fixed the problem for me, too. Not the cleanest solution, though :-(
Comment #7
MO-2 CreditAttribution: MO-2 commented#2 worked for me. Thanks.