I have a content type called Cars, and a content type called Prices. They are node referenced. The Prices content type has a decimal cck field for the price called field_price. So you can create a new Prices node that will have the price for the car. There are multiple Prices nodes for each Car node. In views, how would I be able to show the lowest and highest prices for the car. For instance, it would say, Prices for this car range from $10,568 to $18,259.
-
2Why do you create the price as a content type instead of using a CCK field that allows multiple values to hold the price?– googletorpJun 27, 2011 at 9:12
-
For price comparison shopping. It is actually a little more complicated than I explained. Each Price node for a certain car is put into a view and attached to a car node. It has the sellers name, the price, and the sellers link to that car.– JoeJun 27, 2011 at 19:48
1 Answer
There may be a more fancy-pants way to do this, but I would take the view template, extract the car type, and do a manual MIN() MAX() query to fetch these values.
-
-
You'd want it on the page template, not the field, right? I mean, the answer is yes, put it in the appropriate template. Or rather, write the function in a module somewhere and call it in the template.– EntenduJun 30, 2011 at 18:47
-
But if this is a view, it needs to go in a field tpl to be added to the view. Printing it in the page tpl would just print it arbitrarily on the page. Am I correct?– JoeJun 30, 2011 at 18:52
-
It really depends on how your view is structured. If the view is a list of the members of one type of automobile, then you wouldn't want a count on each field. If the view is a list of types, you /would/ want the count on each field. Make sense? I'd just put it generally: add the code to the appropriate tpl ;)– EntenduJun 30, 2011 at 23:49