Answer the question
In order to leave comments, you need to log in
Who knows how to make this software filter for Views?
This is a question for real gurus.
1. There is a product type node
2. The product has a multiple field "Offer" (Anton 100 rubles. Igor - 200 rubles), that is, Anton offers this product for 100, Igor for 200. The multiple field has 2 fields, respectively - Name and Price.
3. Views gives a filter in the form of a field in which we simply enter the name of several products separated by a space “Bread Points”
4. Views gives a list of all offers for these products:
Bread - 100 rubles
Bread - 200 rubles
Glasses - 15 rubles
Points - 60 rubles
QUESTION:
How can I make views display one offer with the lowest price for each product?
Bread - 100 rubles
Points - 15 rubles
Answer the question
In order to leave comments, you need to log in
I warn you in advance that I am answering a question not posed. The solution is purely code and not for Views. But maybe someone will come in handy.
$searchString = "Хлеб Очки";
$searchArrray = explode(" ",$searchString);
$searchNids = array();
foreach($searchArray => $itemTitle) {
$query = new EntityFieldQuery();
$query->entityCondition('entity_type','node')
->entityCondition('bundle','YOUR_NODE_TYPE')
->propertyCondition('title', $itemTitle ,'LIKE')
->fieldOrderBy('field_PRICE','value','ASC')
->range(0,1);
$result = $query->execute();
if(!empty($result['node'])){
$searchNids[] = array_keys($result['node']);
}
})
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question