Hello
There is a problem, look forward to your help:).
There is a site http://www.ukraineworld.com.ua/en. It has a directory of nodes http://www.ukraineworld.com.ua/en/countries.
They cite a field tour through CCK Reference, for example http://www.ukraineworld.com.ua/en/node/15
The home page displays the last added tours with views 2. It displays the name of the tour, tizer and country icon, created through the image attach and inserted through the relationships of country's node, referred to by the tour.
The problem is that the icon should theoretically link to Node country from which it is inserted, but it refers to the tour itself, to which it is attached in this view.
The question - how can i change the default image attach link in this view, so it can link to node from which it was inserted.
Here is the code
SELECT DISTINCT(node.nid) AS nid,
node_node_data_field_countries__image_attach.iid AS node_node_data_field_countries__image_attach_iid,
node.title AS node_title,
node_revisions.teaser AS node_revisions_teaser,
node_revisions.format AS node_revisions_format
FROM node node
LEFT JOIN content_field_countries node_data_field_countries ON node.vid = node_data_field_countries.vid AND node_data_field_countries.delta = 0
INNER JOIN node node_node_data_field_countries ON node_data_field_countries.field_countries_nid = node_node_data_field_countries.nid
LEFT JOIN image_attach node_node_data_field_countries__image_attach ON node_node_data_field_countries.nid = node_node_data_field_countries__image_attach.nid
LEFT JOIN node_revisions node_revisions ON node.vid = node_revisions.vid
WHERE (node.type in ('tour')) AND (node.language in ('***CURRENT_LANGUAGE***'))
Thanx!
Comments
Comment #1
joachim commentedSo just to get this right....
You have:
- image
-- attached to country
--- noderef by tour
or in other words,
- tour
-- points to country (with noderef)
--- points to image (with image_attach)
And your attached image field's 'link to node' option links to the tour, rather than the country.
It sounds like there is some hardcoding in the handler that shouldn't be there -- field names shouldn't be used explicitly but with the whole $values->{$this->field_name} type of construction. This ensures you get the value in question even when the field has arrived in the view through a relationship.
Comment #2
joachim commented#518804 by joachim: Fixed image_attach field not linking to attaching node or working with relationships.
Had:
$values->nid
instead of:
$values->{$this->aliases['nid']}
Committed a fix. A new development snapshot will be available in the next few hours. Please test it and report back here :)