Hello,

what is the best way when i will override a value in Views before the results are sorted?

I have a Locations-View with distance-Field - this use sort-criteria Distance/Proximity.

Before Views sort Distance-Values i will override any values but I always fail!

I despair!

What Function/Hook i must take for this?

Is here someone so nice and could help me?

Thank you very much and best regards
Matthias

Comments

Berliner-dupe created an issue. See original summary.

Berliner-dupe’s picture

Issue summary: View changes
Berliner-dupe’s picture

Advanced explanation:

Ok – i have a Location-View (block) for show nodes “in the near”! Here i use contextual-filter (NID)! The block is embed over “views_embed_view” in different nodes. Every node have an adress (lat/lon).

Relative to nodes lat/lon the View-Block show other nodes “in the near”!

The results in View (for example) are sorted by “distance” (shortest distance first):

Name1 – 10,43 km
Name2 – 15,78 km
Name3 – 17,75 km
Name4 – 18,45 km
Name5 – 19,28 km
Name6 – 25,69 km

Now i have „spezial nodes“ with special fields (over node_load i will get the fields and if one field have a specific value i will override any distance-values in the View)!

I need it so for exapmle (if view is in one special node):

Name1 – 10,43 km
Name2 – 15,78 km
Name3 – 0 km
Name4 – 18,45 km
Name5 – 0 km
Name6 – 25,69 km

You see – Name3 and Name5 are “0 km” now .... AND the sorting ist not correct so i need a "resort" for this view. Which distance-value must overridden i dont know before - the come from special field from node.

At the end i need the view in „spezial nodes“ so:

Name3 – 0 km
Name5 – 0 km
Name1 – 10,43 km
Name2 – 15,78 km
Name4 – 18,45 km
Name6 – 25,69 km

First question: How can i override programmatically any distance values in the embed view when special-field in node is available?
Second Question: How can i sort the views-results new after the distance-value are overriden?

What function/hook/method i must take for this?

Sorry for my bad english - i hope you understand my problem now!

MustangGB’s picture

Status: Active » Closed (outdated)

Closing this as outdated to tidy up a bit around here. If you're still having problems with the latest release please create a new issue.