Help with number formatting for this custom filter.

Events happening in the community are now at Drupal community events on www.drupal.org.
jimkomara's picture

Hello group! I am stuck and wondered if there are any php wizards that can help. I have created a custom search filter, but since I had to do a couple of functions in the code to get it to work with the Drupal filter, I now do not know how to format the numbers with a comma. i.e. 300,000. Can't figure out how to format a range function???

Here is the code for how I am building the drop down select list for the price field. *Note that I attempted to use the slider_filter, but it did not work in IE. We are willing to hire for some help on that one!

If anyone needs to implement a similar filter page, it is working great, I can post or send you the full module code. I built it from several examples I collected around the Drupal forums.

$price_steps = range(0, 1000000, 50000);
$price_steps_values = range(0, 1000000, 50000);
$low_price_array = array_combine($price_steps,$price_steps_values);

$high_price_steps = range(50000, 5000000, 50000);
$high_price_steps_values = range(50000, 5000000, 50000);
$high_price_array = array_combine($high_price_steps,$high_price_steps_values);

$form['slider_filter']['min']['#type'] = 'select';
$form['slider_filter']['min']['#size'] = 1;
$form['slider_filter']['min']['#options'] = $low_price_array;

$form['slider_filter']['max']['#type'] = 'select';
$form['slider_filter']['max']['#size'] = 1;
$form['slider_filter']['max']['#options'] = $high_price_array;

This is the link to the test page. http://c21footeryan.listingpoint.com/search-results-gallery

We have spend a LOT of time creating a data migration routine that connects RETS to Drupal. We are hoping this will lead to a lot of new sales, so I will be looking for help in the near future. We already have 4 more projects lined up to deliver. I would prefer to find a good programmer in Ohio, since I have had issues in the past dealing with developers that are far away. We are located near Youngstown, but I don't mind a drive to Columbus every once in a while, especially for programmer meetings and good Columbus food. I also go to Cleveland a few times a month if there is anyone up North here that has an interest. I may be wrong but it seems there are a lot more programmers in Columbus.

Cheers!

Jim

Comments

number_format method

mradcliffe's picture

Can you use number_format?

Edit: I hope this doesn't spam twice. Sorry, if it does.

It looks like this is an exposed view. I know that views_handler_field_numeric uses the above function. Can you change your cck field setting for that field to display with a comma?

Thank you for trying

jimkomara's picture

No sorry I already tried the number_format, I think I put it on the wrong part of the process so I will need to figure out exactly where in the code it goes. We did format the cck field, but I have to over-ride it in order to create the drop down list from a field that is not a drop down list. so, stuck one that too.

Did you alter the views

mradcliffe's picture

Did you alter the views filter handler to your own for that field? You could always do it that way to manipulate the exposed form in the exposed_form() method. Not very pretty though.

Central Ohio

Group categories

Topics

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: