Download & Extend

HS + Views: exposed filters in block + hs_taxonomy_views results in fatal error on clone_view() when node counting enabled

Project:Hierarchical Select
Version:6.x-3.7
Component:Code - Taxonomy Views
Category:task
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

I have several hierarchical select widgets exposed in a views filter block. This breaks my whole site with the following error.

[code]Fatal error: Call to a member function clone_view() on a non-object in /home/businesspoint/www/sites/all/modules/hierarchical_select/modules/hs_taxonomy_views.module on line 429[/code]

The only way I could fix my site was to use drush to disable hs_taxonomy_views.

Anyone know what might be causing this?

Comments

#1

I have exact same problem, anyone can help....

#2

I get this error when I set Exposed form in block in Views. It works fine if the exposed form is part of the view.

#3

I've been trying to fix this problem.

The problem is that the views object is the current view (views_get_current_view() function).
But when the Exposed form is in a block, there is no current view as the block is seperate from the views page.
If somehow we can get the view object that is linked to this block into hs_taxonomy_views_hierarchical_select_entity_count($item, $params).
I've tried passing it in with $params, but the $params used here is not set in the hs_taxonomy_views.module.
I'm sure there is a way, I'm just missing it.

#4

I didn't find it, hopefully you can :)

See http://drupal.org/node/342991#comment-1894652, point 1.

#5

Category:bug report» task

#6

This only happens for me when I set 'display node count' or 'require asoc node' to enabled. In other cases, it works fine in exposed block.

#7

Title:Views Exposed filter in block + hs_taxonomy_views results in fatal error on clone_view()» Views Exposed filter in block + hs_taxonomy_views results in fatal error on clone_view() when node counting enabled

Thanks, updated the title.

#8

Title:Views Exposed filter in block + hs_taxonomy_views results in fatal error on clone_view() when node counting enabled» HS + Views: exposed filters in block + hs_taxonomy_views results in fatal error on clone_view() when node counting enabled
Project:Hierarchical Select» Views
Version:6.x-3.x-dev» 6.x-2.x-dev
Component:Code - Taxonomy Views» exposed filters

Let's move this to the Views issue queue to hopefully get some feedback.

Dear Views developers: the problem is that we need to get the $view object when the views exposed filters are displayed in *a block* instead of in the main content. Isn't there any way we can get it? Thanks! Feel free to move this issue back to the HS issue queue when you've replied :)

#9

Hey! This is still an issue. It will work if you disable the display node count' or 'require asoc node" as morning time spotted. (Nice spot)

Any one able to get it working without disabling these?

#10

I have that error if i modify views-exposed-form.tpl.php like

    <div class="views-exposed-widget">
      <input type="submit" id="edit-submit" value="Поиск"  class="form-submit" />
    </div>

when i role back to
   
    <div class="views-exposed-widget">
      <?php print $button ?>
    </div>

evresin work ok. If you modify render block, role back to default and test it

#11

Hello, somebody can take a look to this problem? Please

#12

@Wim

Dear Views developers: the problem is that we need to get the $view object when the views exposed filters are displayed in *a block* instead of in the main content. Isn't there any way we can get it? Thanks! Feel free to move this issue back to the HS issue queue when you've replied :)

Where do you need it?
Anywhere or in a form_alter?

#13

Is there somebody of HS module listening?

#14

@tourtools
Noone likes if you push the issue often. Thats not really fair to all the people.

#15

Got it, I'll be more silent than a stone :-)

#16

Title:HS + Views: exposed filters in block + hs_taxonomy_views results in fatal error on clone_view() when node counting enabled» node counting

where do i change the node counting setting?

#17

Title:node counting» HS + Views: exposed filters in block + hs_taxonomy_views results in fatal error on clone_view() when node counting enabled

restoring the previous title

#18

Lost track of this issue for a while, sorry.

@dereine Anywhere. I've implemented an override for views_handler_filter_term_node_tid, that allows users to use Hierarchical Select instead of a normal select to pick terms in their exposed filters. But HS does an AHAH callback, in which it re-renders the entire form (by calling the form definition function, it doesn't use the cache) and therefore must restore the $view object *before* that form definition function is called (that's how the Views exposed filters form demands it). But as said in http://drupal.org/node/342991#comment-1894652, point 1: views_get_current_view() doesn't always seem to work properly. It is called in hs_taxonomy_views.module, in the hs_taxonomy_views_hierarchical_select_entity_count() function, which works fine during a normal page load, but not during an AHAH callback.
For HS Taxonomy Views, I've set up a custom menu callback so I can load the view back: hs_taxonomy_views_json($view_name, $display_id). When it is called, it loads the view and executes the display and then performs the normal form building stuff.

As I write this, I find it confusing myself and don't understand the problem entirely anymore. AHAH is such a mess in Drupal. Views is such a mess in combination with AHAH, and its exposed filters form functionality is kind of a mess too.

I think I've mostly wasted your time if you've read this. My apologies in advance. If I did, I'm going to move this back to the HS issue queue and then wait for somebody to sponsor it. It's too frustrating and takes too long to fix in my spare time.

#19

dereine, could you maybe shed some light on my reply and questions in #18? Thanks! :)

(Then I can move this issue back to the HS issue queue.)

#20

Subscribing. I see a related warning when setting "Display the node count" or "Require associated node" in Views Hierarchical Select. [edit: full error message included, error is repeated per node]

user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '***CURRENT_USER*** WHERE term_node.tid = 18935 ) count_alias' at line 8 query: SELECT COUNT(*) FROM (SELECT DISTINCT(node.nid) AS nid FROM node node LEFT JOIN votingapi_cache votingapi_cache_node_points_vote_sum ON node.nid = votingapi_cache_node_points_vote_sum.content_id AND (votingapi_cache_node_points_vote_sum.content_type = 'node' AND votingapi_cache_node_points_vote_sum.value_type = 'points' AND votingapi_cache_node_points_vote_sum.tag = 'vote' AND votingapi_cache_node_points_vote_sum.function = 'sum') INNER JOIN term_node term_node ON node.vid = term_node.vid INNER JOIN users users ON node.uid = users.uid INNER JOIN node_comment_statistics node_comment_statistics ON node.nid = node_comment_statistics.nid LEFT JOIN content_type_topic node_data_field_emb_videofield_00 ON node.vid = node_data_field_emb_videofield_00.vid LEFT JOIN history history_user ON node.nid = history_user.nid AND history_user.uid = ***CURRENT_USER*** WHERE term_node.tid = 18935 ) count_alias in /var/www/drupal/sites/all/modules/hierarchical_select/modules/hs_taxonomy_views.module on line 535.

#21

It's highly recommened to paste the full error message.

#22

Question: Is there anything about the fact that this all seems to work fine when you do a preview in the view? Could that leave any clues to why this error is happening? I have no idea of what real differences are between the display of HS in the preview mode versus display of it on a page are, but perhaps someone with a better understanding of the inner workings of views and HS may.
In my testing I have a view with a page display that has an exposed hierarchical taxonomy filter. On the filter I am using the "Is one of" operator and the optional option. In the configure hierarchical select settings I have the following settings set:
Save only the deepest term
Allow the user to choose a term from any level
Display node count: Enabled
Require associated node: Enabled
Resizable: Enabled
I have two label levels enabled and labels entered
Dropbox is not enbaled

You can see in this screencast how it is working perfectly in the page preview (node counts are there and only those taxonomies with related nodes are showing): http://screencast.com/t/NGQ3ZjQw

But when I try to load the page with this view I get the error. Sorry I don't understand the inner working of all of this well enough yet to shed any more light on how to fix the issue, but perhaps the difference in behavior between the two displays is a clue.

#23

Also note that I tried switching Use AJAX: No to Yes thinking that it may more closely replicate what is happening in the Views page preview, but that didn't change anything as far as the fatal error message being displayed.

#24

I'm having this aswell I think.

HS and HS taxonomy and HS Taxonomy view modules

Fields, just Node title,
Filters: node type and Exposed Taxonomy term filter using hierachical select

Works fine in page and in preiview

WSOD in block.

tried printing the node in a block, same result (probably the same thing I guess)

If I can provide any more clues for you let me know

#25

sob! Will this issue solved?! How can we give you dereine clues on this problem?

#26

subscribing

#27

We're getting the same thing. This makes it very difficult to create a customized search page where people can choose to search by country, state, city, etc. The list for the entire world is pretty long, so it's a lot easier for people to search if they can narrow it down first before getting to their final list of options.

#28

I nearly fixed this, if the actual view name or view id was passed to

function hs_taxonomy_views_hierarchical_select_entity_count($item, $params) {}

in $params

One could then load the view if views_get_current_view fails.

Unfortunately, there's currently no reliable way of knowing what view the filters are requested for at that point.. yet.

DT

#29

subscribing

#30

subscribing too.

#31

I do not understand much about how views functioning with exposed filters in block, but filter block certainly can figure out about view it is referencing. Why not to develop a function to provide at least a name of views associated with block? One can, for instance, use it in
hs_taxonomy_views_hierarchical_select_entity_count() hook in hs_taxonomy_views module to load missing view with views_get_view('your_view_name') function.
Can't do it myself right now, though. So, if someone pick up this idea... would be nice.

#32

in the meanwhile how can i do to see my again my website and to remove the hs module?
thanks
A

#33

You can try to disable hs_taxonomy_views via phpMyAdmin or MySQL command line
(as directed in http://drupal.org/node/157632). If you have shell access you could also
install the command line utility Drush and then issue "drush pm-disable hs_taxonomy_views"

#34

Subscribing. Any progress on this ?

#35

Subscribing also.

#36

Hi Ben, Craig here in "shakey" Christchurch
I need to contact you to discuss a problem with the aegir on the saleofthestars server
I cant find the ip address to access the manager and install a new site

Send me a email at craigbroomhall@xtra.co.nz wiyth your new email address and I discuss with you

Thanks Craig

#37

hi Tim all
Somebody help me with my requirement pls...I want to allow my users to choose their front page and save the selection with their profile.Next time they log in they have to see only the terms which they are selected before.

Exmple: My site(job portal) having 3 vocabularies

1.City
--New delhi
--Banglore

2.Experience
--1 year
--2year

3.Technology
--PHP
--Java

Here i need logged in users to choose the terms

for example a person from Banglore with one year experience in PHP Will have to choose these terms in his front page.
Pls help as soon as possible and advance thanks for your precious time.

#38

How does your request relate to this issue subject?
i.e.: HS + Views: exposed filters in block + hs_taxonomy_views
results in fatal error on clone_view() when node counting enabled
.
You may want to take a look at Content Profile.

#39

Subscribing

#40

subscribing.

I've debugged the code and can confirm that $current_view = views_get_current_view(); returns false which triggers the error on clone_view(). How to fix this though I am at a loss like everyone else.

#41

I have used a hack for it to work. Note this only works if you are only using one view for the whole website where you want to use the select entity count.

replace line 449 in hs_taxonomy_view.module with

$current_view = views_get_view('VIEW NAME');

Use with caution.

#42

sub

#43

sub

#44

sub, love Views module but it's difficult sometimes...

#45

Status:active» postponed (maintainer needs more info)

This issue is so convoluted and has drifted that I can't even understand what's wrong. Someone needs to summarize. The fact that it's all about Hierarchical Select makes it *really* difficult because HS is just a tricky, difficult piece of code.

#46

Status:postponed (maintainer needs more info)» closed (cannot reproduce)

#47

Status:closed (cannot reproduce)» active

OK, this is still present on my site with Drupal 6.20, HS 6.x-3.7, Views 6.x-2.12 so changing status to cannot reproduce seems a bit hasty, unless Drupal core magically solves it in 6.22.

Brief summary:

Steps to reproduce - create a view with exposed taxonomy filters that make use of both hierarchical select and node counting, then select exposed filters in block and save the new view. Go to block setup and enable the associated block(s). Viewing any page containing the blocks results in WSOD

The error - apache logs show
PHP Fatal error:  Call to a member function clone_view() on a non-object in PATHTOSITE/modules/hierarchical_select/modules/hs_taxonomy_views.module on line 452 on my setup, appears to be the same for other people

The cause - devkinetic at #40 confirms error as caused by $current_view = views_get_current_view(); returns false which triggers the error on clone_view()

Fixing broken sites - #33 suggests to install the command line utility Drush and then issue "drush pm-disable hs_taxonomy_views", i.e. disable the hs_taxonomy_views module. This worked for me when I enable the exposed filter block for all pages on my site.

#48

Status:active» closed (won't fix)

modules/hs_taxonomy_views.module

This isn't hs_taxonomy_views queue. This is views. That's a different module. File bugs appropriately, please.

#49

Project:Views» Hierarchical Select
Version:6.x-2.x-dev» 6.x-3.7
Component:exposed filters» Code - Taxonomy Views
Status:closed (won't fix)» active

Moving back to Hierarchical Select queue in that case. Joy.

#50

It's been a while. Has anybody found a solution for this? There should be a warning -as not supported feature- of this issue in the download info of the module since it's been so long that the issue is open and has no solution yet

#51

Subscribe

#52

Subscribe