Datafeedr Support Forums  

Go Back   Datafeedr Support Forums > Current Version (V3) Forum > Feature Requests
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 February 4th, 2011, 03:55 PM
ayorofrance ayorofrance is offline
 
Join Date: Sep 2010
Posts: 430
Default Split Products per Page and Sort Order

It would be great if you could set one without setting the other... This will especially be true once the "sort by click through" is released, where you might want to retain that sort order even if you change the number of product per page...

Also it is a bit confusing that you need to click the Go button next to the Sort Order if you want to change the PPP... so perhaps add another Go button next to PPP?
__________________
WordPress Security - Is your WordPress secure? Get our FREE checklist and find out.

Easy-Email - Access ALL your email accounts with one login & synchronize automatically on all your computers.
  #2  
Old February 9th, 2011, 09:47 AM
firstprod firstprod is offline
 
Join Date: Jul 2009
Posts: 71
Default

Quote:
Originally Posted by ayorofrance View Post
It would be great if you could set one without setting the other... This will especially be true once the "sort by click through" is released, where you might want to retain that sort order even if you change the number of product per page...

Also it is a bit confusing that you need to click the Go button next to the Sort Order if you want to change the PPP... so perhaps add another Go button next to PPP?
Assuming that the initial PPP is set to be the same as the actual number of products displayed, then all you need to do is add the code for a second "Go" button yourself - the sorter is effectively a form, so you can have as many submit buttons as you want.

eg: I do exactly this on my sites, with the default display number set to 18 and 18 preselected in the "show" drop down. See the two "Go" buttons in the code <input type="submit" value="Go" class="dfsbmt" />.

HTML Code:
<form method="get">
    <span class="dflside">
      Products per page:
      <select name="ppp" class="dfppp" onchange='this.form.submit()'>
        <option value="18"<?php if (@$_GET['ppp']=='18') {echo ' selected="selected"';}?>>18</option>
        <option value="36"<?php if (@$_GET['ppp']=='36') {echo ' selected="selected"';}?>>36</option>
        <option value="54"<?php if (@$_GET['ppp']=='54') {echo ' selected="selected"';}?>>54</option>
      </select>
<input type="submit" value="Go" class="dfsbmt" />
    </span>
    <span class="dfrside">
      Sort by:
      <select name="sort" class="dfsort" onchange='this.form.submit()'>
        <option disabled="disabled" selected value="Choose">Choose how to sort these items</option>
<option value="-price"<?php if (@$_GET['sort']=='-price') {echo ' selected="selected"';}?>>Price (high to low)</option>
        <option value="price"<?php if (@$_GET['sort']=='price') {echo ' selected="selected"';}?>>Price (low to high)</option>
        <option value="name"<?php if (@$_GET['sort']=='name') {echo ' selected="selected"';}?>>Product Name (a - z)</option>    
        <option value="-name"<?php if (@$_GET['sort']=='-name') {echo ' selected="selected"';}?>>Product Name (z - a)</option>    
      </select>
<input type="submit" value="Go" class="dfsbmt" />
</span>
<div class="clearingdiv">&nbsp;</div>
</form>
  #3  
Old February 9th, 2011, 10:26 AM
ayorofrance ayorofrance is offline
 
Join Date: Sep 2010
Posts: 430
Default

Hi firsrprod,

Thanks for your suggestion...

Only having one form for both ppp and Sort still means that you will update both parameters if you click one of the buttons...

If your default layout is 12 ppp and random sort of products changing the ppp will also change the sort order...

In the end I split the code into two forms like this:
Code:
<div class="dffltrs">
  <span class="dflside">
    <form method="get">
      <?php if (@$_GET['word']){ echo "<INPUT TYPE='HIDDEN' NAME='word' Value='".search_word_value($_GET['word'])."' />"; } ?>
      <?php if (@$_GET['price']){ echo '<INPUT TYPE="HIDDEN" NAME="price" Value="'.search_word_value($_GET['price']).'" />'; } ?>
      <?php if (@$_GET['sort']){ echo '<INPUT TYPE="HIDDEN" NAME="sort" Value="'.search_word_value($_GET['sort']).'" />'; } ?>
      Products per page:
      <select name="ppp" class="dfppp" onchange='this.form.submit()'>
        <option value="12"<?php if (@$_GET['ppp']=='12') {echo ' selected="selected"';}?>>12</option>
        <option value="24"<?php if (@$_GET['ppp']=='24') {echo ' selected="selected"';}?>>24</option>
        <option value="36"<?php if (@$_GET['ppp']=='36') {echo ' selected="selected"';}?>>36</option>
        <option value="48"<?php if (@$_GET['ppp']=='48') {echo ' selected="selected"';}?>>48</option>
      </select>
      <input type="submit" value="Go" class="dfsbmt" />
    </form>
  </span>
  <span class="dfrside">
    <form method="get">
      <?php if (@$_GET['word']){ echo "<INPUT TYPE='HIDDEN' NAME='word' Value='".search_word_value($_GET['word'])."' />"; } ?>
      <?php if (@$_GET['price']){ echo '<INPUT TYPE="HIDDEN" NAME="price" Value="'.search_word_value($_GET['price']).'" />'; } ?>
      <?php if (@$_GET['ppp']){ echo '<INPUT TYPE="HIDDEN" NAME="ppp" Value="'.search_word_value($_GET['ppp']).'" />'; } ?>
      Sort by:
      <select name="sort" class="dfsort" onchange='this.form.submit()'>
        <option value="price"<?php if (@$_GET['sort']=='price') {echo ' selected="selected"';}?>>Price (low to high)</option>
        <option value="-price"<?php if (@$_GET['sort']=='-price') {echo ' selected="selected"';}?>>Price (high to low)</option>
        <option value="name"<?php if (@$_GET['sort']=='name') {echo ' selected="selected"';}?>>Product Name (a - z)</option>    
        <option value="-name"<?php if (@$_GET['sort']=='-name') {echo ' selected="selected"';}?>>Product Name (z - a)</option>    
      </select>
      <input type="submit" value="Go" class="dfsbmt" />
    </form>
  </span>
  <div class="clearingdiv">&nbsp;</div>
</div>
This allows you to update one and not the other...

Because this is now two forms the background color does not span the line, so I added this to the Custom CSS in the store:
Code:
#view .dffltrs {border: 0px #E6E6E6 solid; margin: 10px 0;}
#view .dffltrs form {background-color: #FFFFFF;padding: 5px;margin: 1px;}
Also notice how I store any other parameters (code in italics).

Cheers,

Anders
__________________
WordPress Security - Is your WordPress secure? Get our FREE checklist and find out.

Easy-Email - Access ALL your email accounts with one login & synchronize automatically on all your computers.
  #4  
Old February 9th, 2011, 10:34 AM
firstprod firstprod is offline
 
Join Date: Jul 2009
Posts: 71
Default

Hi Anders,

Another nice solution.

If you take a look at my code, the "sort by" drop down is initially unselected and shows a user prompt, so changing the number of products displayed doesn't change the sort order unless this is deliberate by the end user - ie the sort order across both selections is always consistent with the users choice.

This also gets around the problem of displaying sort order text that does not match the physical sort order initially used by the page if you set it to "Random", as every page displays the text "Choose how to sort these items" on the drop down instead of one of the 4 sort order options.

Regards
  #5  
Old February 9th, 2011, 11:46 AM
ayorofrance ayorofrance is offline
 
Join Date: Sep 2010
Posts: 430
Default

Ah, I see... very nice touch - thanks for point that out!!
__________________
WordPress Security - Is your WordPress secure? Get our FREE checklist and find out.

Easy-Email - Access ALL your email accounts with one login & synchronize automatically on all your computers.
 


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
Adding 'products per page' and 'sort by' drop down menus to pages lbuilta59 Questions 1 January 27th, 2011 10:36 AM


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


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