KonaKart Community Forum

Installation / Configuration => Programming of KonaKart => Topic started by: ScottS on April 19, 2011, 12:01:51 pm

Title: How to search for products within a price range?
Post by: ScottS on April 19, 2011, 12:01:51 pm
I'm trying to set up KonaKart and I have a question.

I need to set up a search query that will return products within certain price ranges.
I've seen this on many ecommerce sites. For example:

$10.00 - 49.00
$50.00 - 99.00
$100.00 - 150.00

Etc..

I have looked all over but can not find any information on how to do this with KonaKart.

Can you point me in the right direction?
Title: Re: How to search for products within a price range?
Post by: trevor on April 19, 2011, 01:02:27 pm
You need to use the API call used when doing an advanced search. Take a look at AdvancedSearchSubmitAction.java. Here you can add price filters.
Title: Re: How to search for products within a price range?
Post by: ScottS on April 19, 2011, 01:14:53 pm
I found the .java file that you are referring to.
Is there any documentation regarding as to how to do this?
Title: Re: How to search for products within a price range?
Post by: trevor on April 19, 2011, 01:21:22 pm
No. It's a standard JSP / Struts / Tiles application so you really have to be familiar with those technologies and then it's relatively easy.
Title: Re: How to search for products within a price range?
Post by: ScottS on April 19, 2011, 02:12:45 pm
I understand that this is a JSP / Struts / Tiles application.
I also have a grasp on the technologies.
Though I don't consider myself an expert.

However, This is a project to help me in building strength in these technologies.

Now, when I look at your demo store and look at the advanced search,
there is like you said a section to search by price from and to.

But...

No matter what values I put in there it comes back as no products found.

If that search worked, I'd be able to use that as an example of what I needed to do to make my
search query work but it doesn't.

This is what I need to find out.

Please help.
Title: Re: How to search for products within a price range?
Post by: trevor on April 19, 2011, 02:58:13 pm
That's just because it expects some search text. In order for it not to require any search text you can make the following change in the action class:


           if (spf.getSearchText() != null && spf.getSearchText().length() > 0)
            {
                ps.setSearchText(spf.getSearchText());
            }