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 April 18th, 2013, 05:14 PM
Chez2006 Chez2006 is offline
 
Join Date: Jul 2009
Posts: 28
Default Filter by min & max price

Hi

Is it possible to set a filter by a user generated min and max price?

I know you can set up a filter along the the lines of 10-20, 20-30, 30-40 and so on, but what I'm looking for is a way for the user to set a minimum and maximum price, in the same way as it's done in the factory product search.

I'm currently rebuilding a site that I haven't touched for a couple of years and want to add a price filter to the sort order form on the category page.

Thanks
Paul
  #2  
Old April 18th, 2013, 05:40 PM
Eric's Avatar
Eric Eric is offline
Datafeedr Team
 
Join Date: Feb 2008
Posts: 16,902
Default

Hi,

Yes, it's a little tricky because you have 2 input fields which need to make up 1 $_GET value.

For example, you need to have a Min and Max input field but pass the "price" field to the browser with the min and max as part of the "price" field.

Here's how you might be able to do it using jQuery: http://jsfiddle.net/oreamnos/utTYM/1/

Eric
  #3  
Old April 18th, 2013, 06:12 PM
Chez2006 Chez2006 is offline
 
Join Date: Jul 2009
Posts: 28
Default

That was quick. I wasn't expecting a reply until tomorrow.

I did think about javascript, but was hoping to get away with not using it, as the form will add the 3 values to the url. but that's not really a big issue.

what I was wondering though was whether I could use php to add the two values together by adding a bit of code somewhere in the plugin code.
  #4  
Old April 18th, 2013, 06:13 PM
Eric's Avatar
Eric Eric is offline
Datafeedr Team
 
Join Date: Feb 2008
Posts: 16,902
Default

Hi,

I'm not 100% sure but I don't think that it's possible to add more $_GET variables to the URL without intercepting the request and redirecting it.

Eric
  #5  
Old April 18th, 2013, 06:27 PM
Chez2006 Chez2006 is offline
 
Join Date: Jul 2009
Posts: 28
Default

Thanks Eric

I'm having a play with the Javascript option. I'll post a link if I get it working.

Many Thanks.
Paul
  #6  
Old April 18th, 2013, 06:31 PM
Eric's Avatar
Eric Eric is offline
Datafeedr Team
 
Join Date: Feb 2008
Posts: 16,902
Default

Hi Paul,

OK, thanks!

Eric
  #7  
Old April 18th, 2013, 08:16 PM
Chez2006 Chez2006 is offline
 
Join Date: Jul 2009
Posts: 28
Default

I've got it working with the javascript.

http://www.happydogproducts.co.uk/st...roof-dog-beds/

This is the Min Max Price html that I added to the form

Code:
Price:<br />
Min <input type="text" size="4" value="<?php echo $_GET['minp']; ?>" name="minp" onChange="updateprice()" /> 
Max <input type="text" size="4" value="<?php echo $_GET['maxp']; ?>" id="maxp" name="maxp" onChange="updateprice()" /> 
<input type="hidden" name="price" value="<?php echo $_GET['price']; ?>" />
And the javascript I used was

Code:
<script type="text/javascript">
    function updateprice() {
      document.sorder.price.value = document.sorder.minp.value + '-' + document.sorder.maxp.value;
    }
</script>
  #8  
Old April 18th, 2013, 08:58 PM
Eric's Avatar
Eric Eric is offline
Datafeedr Team
 
Join Date: Feb 2008
Posts: 16,902
Default

Hi Paul,

Thanks for sharing! Glad you got it working!

Eric
  #9  
Old January 23rd, 2014, 01:16 PM
mlt01005 mlt01005 is offline
 
Join Date: Oct 2012
Posts: 9
Smile Javascript newbie

Store ID: 349234
Website URL: www.petiteoutdoor.com/store

Morning!
I just have a question about the integration of this filter into a widget. I'm new to javascript and it's integration into wordpress, I've only worked with php and css thus far. Can you detail where to put the javascript function (i'm assuming it goes in the functions.php file), any additional calls I may need or definitions to put it there and an example of the html to put in the widget?

Thanks so much!

PS. The only help I've found is at the following link but being a newbie it's still kind of confusing for me: http://codex.wordpress.org/Using_Javascript

Last edited by mlt01005 : January 23rd, 2014 at 01:18 PM.
  #10  
Old January 23rd, 2014, 01:22 PM
Eric's Avatar
Eric Eric is offline
Datafeedr Team
 
Join Date: Feb 2008
Posts: 16,902
Default

Hi,

I believe the other user simply placed it in their views with the HTML code.

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
Price filter thk1976 Problems 4 March 23rd, 2013 05:29 PM
Price filter has a bug officialwatch Problems 1 November 6th, 2012 08:26 AM
Price filter quitjob Questions 1 March 18th, 2012 09:59 AM
'Remove Price filter' like brand filter Giftoly Questions 1 January 20th, 2012 10:48 AM
Price Filter Not Working bredies Problems 1 May 29th, 2011 12:18 AM


All times are GMT -5. The time now is 01:15 PM.


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