Project:Views Custom Field
Version:6.x-1.x-dev
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

I am not sure if this issue is for views_customfield or faceted_search so I am posting to both.
I am using views_customfield module and faceted_search module.
I have a main view that works with faceted_search to display results of a particular node type.
In that main view I am using a field from views_customfield module.
The field is Customfield: PHP Code.
In that field I am using the Drupal function "views_embed_view" to embed a view within a view for each result.
If I limit the main view to display 5 results per page, in which one of the results displayed on the first page display the embedded view, the results appear fine.
If I increase the main view to display 20 results per page, "Your search yielded no results" appears.

I have been debugging for days, and after commenting every single function in faceted_search.module and faceted_search_ui.module I determined that the difference when viewing 5 results vs 20 results is that:

5 results: in theme_faceted_search_ui_stage_result() function, $pager_total_items[0] == 5
20 results: in theme_faceted_search_ui_stage_result() function, $pager_total_items[0] == 0 <-- this should be 20?

Again, I'm not sure where the issue lies, but I will continue debugging to learn more. For now, I am posting about this issue in case I do discover a bug or a misconfiguration so that if anyone else has a similar issue, they can potentially find a resolution as well.

Comments

#1

http://drupal.org/node/588876

I believe this may be related to faceted_search because when viewing the Views Preview, 20 or 40+ results per page appear fine, however, when viewing in combination with faceted_search results, 5 results per page appears fine, but 20 or 40+ results per page yields No results.

I discovered in sites/all/modules/views/includes/view.inc:
In class view extends views_db_object { }
In function _build($key) { }
line $pager_total_items[$this->pager['element']] = $this->total_rows;

The first/main view calculates the correct 'total' results that should be displayed on the main faceted_search results page.

The view within a view with views_customfield, for each view that is created, affects this value, depending on how many results there are.

I discovered that on my results page when only displaying 5 results per page, since the last result's view within a view does have results of its own, the results are ultimately displayed, views results and views within a view results.

If I changed to 4 results per page, I would have discovered that there were no results, because the 4th result's view within a view has 0 results.

Therefore, I must learn a workaround so that each view within a view result does not affect the main/initial/first/primary view's results, and therefore affect ultimately displaying them or not. Is anyone able to help me discover a solution for this issue?

#2

I am trying to do exactly the same (using views_embed-view in a views custom field) and unfortunately it displays the unparsed html instead of the view itself. Would you mind sharing how you achieved this?

nobody click here