Datafeedr Support Forums  

Go Back   Datafeedr Support Forums > Current Version (V3) Forum > Questions
Home Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Important - The support forums are now in "read-only" mode as we transition to an alternative help desk solution. Feel free to contact us here with any of your questions or search the forums for an existing solution.
 
 
Thread Tools Search this Thread Display Modes
  #1  
Old October 5th, 2012, 07:04 AM
officialwatch officialwatch is offline
 
Join Date: Sep 2012
Posts: 51
Default about sorting

Store ID:
Website URL: http://official-watch.com/
URL to page in question:

sir,no need to reply for my previous thread perhaps i solved it

now i have one more issue:
when i select one of the filter it filters the products accordingly but when i go to sort them according to number of product per page or sorting them alphabetically or in pricing order it doesn't work why??
kindly solve this problem,

this is the code that i have used for" brand by filter"
<<
i created a widget called "drop_down" and paste this code there


<form method="get">

<!-- Brand drop down select menu -->
<select name="brand">
<?php echo dfr_get_brands(); ?>
</select>


<div class="filter_go1"><input type="submit" value="Search" class="filter_go"/></div>


</form>

and for function.php the following code


<?php
function dfr_get_brands() {
global $wpdb;
$brands = $wpdb->get_results("SELECT brand FROM ".$wpdb->prefix."dfr_shop_products GROUP BY brand");
$html = '<option value="">Select a brand</option>';
foreach ($brands as $brands) {
if (trim($brands->brand) != "") {
$selected = (strip_tags(stripslashes($_GET['brand']))==$brands->brand) ? ' selected="selected"' : '';
$html .= '<option value="'.$brands->brand.'"'.$selected.'>'.$brands->brand.'</option>';
}
}
return $html;
}
?>

>>
  #2  
Old October 5th, 2012, 09:10 AM
Eric's Avatar
Eric Eric is offline
Datafeedr Team
 
Join Date: Feb 2008
Posts: 16,902
Default

Hi,

You need to add some hidden fields to your sorting code. I assume you have this:

PHP Code:
<div class="dffltrs">
  <form method="get">
    <span class="dflside">
      Products per page:
      <?php echo datafeedr_tools()->form_select("ppp",
        array(
        
"12" => "12",
        
"24" => "24",
        
"36" => "36",
        
"48" => "48",
        )); 
?>
    </span>
    <span class="dfrside">
      Sort by:
      <?php echo datafeedr_tools()->form_select("sort",
        array(
        
"price"   => "Price (low to high)",
        
"-price"   => "Price (high to low)",
        
"name"     => "Product Name (a - z)",
        
"-name"   => "Product Name (z - a)",
        )); 
?>
      <input type="submit" value="Go" class="dfsbmt" />
    </span>
    <div class="clearingdiv">&nbsp;</div>
  </form>
</div>
You should modify it so you have this:
PHP Code:
<div class="dffltrs">
  <form method="get">
  
      <?php if (@$_GET['brand']){ echo '<input type="hidden" name="brand" value="'.strip_tags($_GET['brand']).'" />'; } ; ?>
      <?php if (@$_GET['price']){ echo '<input type="hidden" name="price" value="'.strip_tags($_GET['price']).'" />'; } ; ?>
      <?php if (@$_GET['word']){ echo '<input type="hidden" name="word" value="'.strip_tags($_GET['word']).'" />'; } ; ?>
  
    <span class="dflside">
      Products per page:
      <?php echo datafeedr_tools()->form_select("ppp",
        array(
        
"12" => "12",
        
"24" => "24",
        
"36" => "36",
        
"48" => "48",
        )); 
?>
    </span>
    <span class="dfrside">
      Sort by:
      <?php echo datafeedr_tools()->form_select("sort",
        array(
        
"price"   => "Price (low to high)",
        
"-price"   => "Price (high to low)",
        
"name"     => "Product Name (a - z)",
        
"-name"   => "Product Name (z - a)",
        )); 
?>
      <input type="submit" value="Go" class="dfsbmt" />
    </span>
    <div class="clearingdiv">&nbsp;</div>
  </form>
</div>
More info can be found here: /show...0216#post20216

Eric
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Sorting Feature feeriejade Questions 6 August 15th, 2012 07:58 PM
Sorting of Products rwestrope Feature Requests 0 July 7th, 2012 08:39 AM
Sorting Template Changes tcsar757 Questions 4 March 29th, 2012 07:16 PM
Sorting by Age lpimco Questions 2 October 4th, 2011 02:05 PM


All times are GMT -5. The time now is 12:54 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.