Closed (fixed)
Project:
Views (for Drupal 7)
Version:
6.x-2.9
Component:
search data
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
1 Nov 2011 at 09:07 UTC
Updated:
2 Jul 2012 at 15:31 UTC
0 down vote favorite
share [fb] share [tw]
my question is how we can expose sort criteria in views 2 drupal. i have a list of cars as a result of search block (exposed filter).i need to add a select box to sort the cars. this is my views theme ""
<div id="listing">
<?php
//Product Line Page
$num = count($rows);
print "<h2>".$num."Cars found</h2>";?>
<div id="compare_link"><a href="<?php echo base_path(); ?>comparison">Compare</a></div>
<?php
$i=0;foreach ($rows as $count => $row){ $i++;
foreach ($row as $field => $content){
//print $fields[$field]."<br>";
switch($fields[$field]){
case 'ops':$compare=$content;break;
case 'field-image-fid': $image = $content; break;
case 'tid': $title = $content; break;
case 'field-counter-value': $counter = $content; break;
case 'field-exteriorcolor-value':$color=$content;break;
case 'title-1':$link=$content;break;
case 'field-year-value':$year=$content;break;
case 'field-bodystyle-value': $body_style = $content; break;
case 'field-price-value': $price = $content; break;
case 'field-country-2-value':$country_image =$content; break;
case 'field-logo-fid': $logo = $content; break;
case 'edit-node':$edit=$content;break;
}
}
?>
<?php if ($color==""){$color="Color";} ?>
<?php if ($body_style==""){$body_style="Body";} ?>
<?php
$array_title = split("/",$title);
?>
<div id="one_list" class="one_list_<?php echo $i ?>">
<div id="compare"><?php print $compare; ?></div>
<div class="list_left_image"><?php print $image ?></div>
<div class="list_middle_text">
<div class="list_title"><?php print $array_title[1]." ".$array_title[0]." " ?>(<?php print $year ?>)</div>
<div class="list_desc"><?php print $counter." " ?>/<?php print $counter*0.62."MIL, " ?>,<?php print $color.", " ?><?php print $body_style ?></div>
<?php if ($i<10) {?>
<div id="country_image"><?php print $country_image; ?></div><div id="new_car"></div>
<? } ?>
<div class="read_more"><?php print $link ?></div>
</div>
<div class="list_right_contact"><div class="price_list"><?php if($price==""){print ("Price On Request"); }else{ print ($price);}?></div><div class="logo_image"><?php print $logo ?></div><div class="seller">Seller's other items</div></div>
</div>
<?php if ($i%5==0) {?>
<div id="section_banner" class="banner<?php print $i ?>"></div>
<? } ?>
<? } ?>
</div>
* so what i need to know is how can i give the ability for the visitors to sort these cars according to the date and price thanks for help
Comments
Comment #1
dawehneri'm sorry but views2 never had the feature to expose the sort criteria.
You should probably make a backup and test whether views3 works for you. Alternative it will require a big amount of custom coding
which seems to be quite hard if i look at your template code.
But the general idea is to add a new filter field via hook_views_data, then write a custom handler, and in this custom handler
alter the exposed form to do exactly what you want it to do.
Comment #2
MohammadMoussa-Lebanon commentedok thanks i will try it , thanks for help
Comment #3
kars-t commentedHi
I am closing this issue to clean up the issue queue. Feel free to reopen the issue if there is new information and the problem still resides. If not please make sure you close your issues that you don't need any more.
Maybe you can get support from the local user group. Please take a look at this list at groups.drupal.org.
Comment #4.0
(not verified) commentedWrap the code with a < code >