After updating to Views 3.6 I am getting the following errors on my products page.

Notice: Undefined property: stdClass::$machine_name in views_plugin_argument_validate_taxonomy_term->validate_argument() (line 108 of sites/all/modules/views/modules/taxonomy/views_plugin_argument_validate_taxonomy_term.inc).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

gb2world’s picture

I am experiencing either the same or a related problem.

After installation of 7.x-3.6 (with Drupal 7.21), none of my taxonomy pages are found.

I've tried disabling clean URLS and the path module - the default path to the taxonomy page still is not found: /?q=taxonomy/term/1

The error reported when trying to view a taxonomy page is:

Notice: Undefined property: stdClass::$machine_name in views_plugin_argument_validate_taxonomy_term->validate_argument() (line 108 of /sites/all/modules/views/modules/taxonomy/views_plugin_argument_validate_taxonomy_term.inc).

osysltd’s picture

Acknowledge. The same bug!

pslcbs’s picture

Same trouble for me

Notice: Undefined property: stdClass::$machine_name en views_plugin_argument_validate_taxonomy_term->validate_argument() (línea 108 de /sites/all/modules/contrib/views/modules/taxonomy/views_plugin_argument_validate_taxonomy_term.inc).

m.ioannidis’s picture

Temp Fix:

File:

/sites/all/modules/views/modules/taxonomy/views_plugin_argument_validate_taxonomy_term.inc

Lines: 106, 107

$term = taxonomy_term_load($term->tid);
$this->argument->validated_title = check_plain(entity_label('taxonomy_term', $term));
Should be:

//$term = taxonomy_term_load($term->tid);
$this->argument->validated_title = check_plain($term->name);

THIS IS A TEMP SOLUTION! JUST TO GET THINGS WORKING!

m.ioannidis’s picture

BETTER SOLUTION:

Change line 108 of /sites/all/modules/views/modules/taxonomy/views_plugin_argument_validate_taxonomy_term.inc
from:

return empty($vocabularies) || !empty($vocabularies[$term->machine_name]);

TO

return empty($vocabularies) || !empty($vocabularies[$term->vocabulary_machine_name]);

That should do it!

jsacksick’s picture

Status: Active » Needs review
FileSize
839 bytes

These lines have been changed in this commit #1914024: Title-overriden term name not translated on a taxonomy overriden views page, the $term variable used to contain the machine_name retrieved by the sql query $query->fields('tv', array('machine_name')); but $term is overriden by a taxomony_term_load and doesn't have the machine_name property, here's the patch that fixes the issue.

Rafix’s picture

I am experiencing he same problem. I see there is a patch but I don't know how to apply it. First time I have to solve something like this.
Can anyone give a guidelines?

Thank you in advance!

roderik’s picture

Status: Needs review » Reviewed & tested by the community

PATCH RUSH :D

I was just making the same patch / trying to find out why 'machine_name' was suddenly not OK anymore, and can echo jsacksick's comments.
(The mentioned issue commit introduced the error by not adjusting the 3rd line in its 1st hunk).

fledev.com’s picture

Status: Reviewed & tested by the community » Needs review

Subscribing to the changes - #6 which worked for me to.

roderik’s picture

Status: Needs review » Reviewed & tested by the community

Inadvertant status change in #9, I assume. This patch has had enough review.

osysltd’s picture

man patch.
patch -p1 < FILE_NAME
put the patch in sites/all/modules/views

jeanyvesberger’s picture

Same problem here.
In contextual filters , i had to change the 'filter value type' from 'term ids' to 'term ids separated by , or +' to make this error disappear. Will try the patch anyway.

Rafix’s picture

Thank you but I don't really know what you say. As I said before, this is the first time I have to use a patch. I am reading about it in drupal (getting involve/ patches) and It is very difficult to me (as my english is only survival and my code experienced is 0, so both thing togehter...)

Would you help me explaining it step by step? I know is very much but with a clear explanation once I will not need asking, and asking other users each time I do an step...

Thank you anyway.

Allthegearnoidea’s picture

Rafix

I'm not here to give advice on applying patches as I struggle with it often too. Though for a simple change like this one I found this very useful: http://drupal.org/node/534548

Essentially though for this fix it is very straightforward:

m.ioannidis's comment (#5) is the way to fix this problem, but to repeat what m.ioannidis has posted, simply do the following (having backed everything up).

Go to the file called views_plugin_argument_validate_taxonomy_term.inc located at /sites/all/modules/views/modules/taxonomy

Open the views_plugin_argument_validate_taxonomy_term.inc file in a code editor of some sort (e.g Editplus). Go to line 108 and change the line from:

return empty($vocabularies) || !empty($vocabularies[$term->machine_name]);

TO

return empty($vocabularies) || !empty($vocabularies[$term->vocabulary_machine_name]);

Save the amended file back in to the /sites/all/modules/views/modules/taxonomy location and the problem is fixed. It really is that simple

So in this case no need to try and apply patches you can simply change the code by editing the file directly. Because it is just a case of amending 1 line.

m.ioannidis thank you for the fix, it sorted my site out straight away.

Rafix’s picture

@Allthegearnoidea @m.ioannidis

Thank you very much. I've just did what you explain me and now it is working perfectly! I guess sooner or later I will need to learn how to apply patches but at this moment you both save me!

Thanks again!

jackdaniel9’s picture

Patch #6 Work

djob’s picture

Had the same issue today with latest views module. Adding vocabulary_ worked for me.
Will this be corrected in future views module download?

thank you

gb2world’s picture

Thanks for patch in #6 - resolved the problem for meas well.

bluehead’s picture

Thanks dude. I tried all patches and none of them worked. Your hint solved my problem - temporarily. Hope there will be a proper patch soon

dawehner’s picture

Status: Reviewed & tested by the community » Closed (duplicate)
greenwork’s picture

This fixed it for me too on my ubercart catalog being blank with a custom view.

samwillc’s picture

Can confirm #6 fixed it for me too :)

marco71’s picture

Nice man thanks for that. I was getting puzzeled. Second fix works fine.