Hi. I wrote a different Apacesolr price module (not integrated with Ubercart) based on this code. I thought I'd report a small bug in this module as well since I just fixed it for my own site.
Let's say you set apachesolr_ubercart_division to 100, so you want to split all of your prices such as $0-$100, $100-$200, etc. The challenge is that when you get to apachesolr_ubercart_price_facet_block and the $to_price calculation, it just splits it all by 100. So what you wind up with are items that are priced at $100 falling into BOTH the $0-$100 facet, and the $100-$200 facet. You end up with a confusing user experience since they faceted on $0-$100, but they also see the other facet.
Here's my fix. In apachesolr_ubercart_price_facet_block(), inside the foreach change it as follows:
$to_price = (($price_range * $division) + $division) - 0.001;
$facet_text = t('from @price_from to @price_to',array('@price_from'=>$from_price,'@price_to'=>round($to_price)));
Basically, we subtract .001 so the value is less than 1 penny smaller, so all items up to $99.99 would fit into the first bucket. I also use the round() function to round that back up when displaying it to the user so they see $0-$99.
I'm not sure if that makes sense or not, and I have not tested with this module because I'm not using it.
Comment | File | Size | Author |
---|---|---|---|
#4 | apachesolr_ubercart-845152.patch | 982 bytes | Nick_vh |
Comments
Comment #1
Nick_vhMarking as critical and will try to follow up asap!
What you say makes sense but I'm not sure if usability wise we should exclude items that are 100$ from the 0-100 range?
Thanks for noticing
Comment #2
rjbrown99 CreditAttribution: rjbrown99 commentedFrom a shopping standpoint, if I'm a shopper and I look for things $0-$100, I would assume that anything $100.00 or above is above that cut line. I think most retailers generally think that way since so many items are priced at $99. In any event I think the bigger issue is just making sure items that are on that 'breakpoint' - be it 20 or 100 or whatever - fit into only one facet bucket and not both.
By the way, your module did work quite well as the basis for the non-Ubercart integrated price facets. Thanks for developing it and releasing it to the public.
Comment #3
Nick_vhPoint made,
could you spare some of your time to make a patch? All kinds of information about that can be found here on drupal.org
Your contribution would be highly appreciated!
Comment #4
Nick_vhAdded to the CVS
Patch added
Comment #5
Nick_vhClosing and marking as fixed