Timeline for Add css-class based on productpages' top level taxonomy term
Current License: CC BY-SA 3.0
6 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Dec 18, 2013 at 10:25 | comment | added | xurshid29 |
@NathanH it's ok.. For node pages you can access to terms by referenced field values. e.g. $node->field_REF_FIELD['und'][0]['tid'] ...
|
|
Dec 18, 2013 at 10:20 | comment | added | Nathan | since arg(0) returns 'node' on my product pages, arg(1) will return the 'node id' and not the 'taxonomy id'. This means that 'taxonomy_term_load' returns an empty object because it can't find a 'taxonomy term' using a 'node id' (or at least that's how it works when I tried it). | |
Dec 18, 2013 at 9:30 | comment | added | xurshid29 |
@NathanH it doesn't matter you are using commerce or ubercart or whatever, taxonomy acts the same.. arg(0) == 'taxonomy' && arg(1) == 'term' works only when you are on a term page, arg(0) == 'node' && is_numeric(arg(1)) works when you are on node pages..
|
|
Dec 18, 2013 at 9:19 | comment | added | Nathan | That doesn't seem to work, since I'm using the commerce module the taxonomy terms are linked to product pages and to show the product on an actual page they had linked to a 'display node' content type. So 'arg(0)' returns 'node' and arg(1) returns the node number, but not the taxonomy term. Also doesn't "taxonomy_get_parents" only get the very first parent of the item? since the top level item and the all of it's child items need the same class I guess I need to change it to 'taxonomy_get_parents_all' and then loop through the array it returns? | |
Dec 17, 2013 at 14:38 | history | edited | xurshid29 | CC BY-SA 3.0 |
deleted 4 characters in body
|
Dec 17, 2013 at 14:31 | history | answered | xurshid29 | CC BY-SA 3.0 |