Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Prices to sort

Quote Reply
Prices to sort
Hi,

I come here with an interesting question (I think Tongue).

I would like to sort results from Links SQL between a lowest price and a highest price.

Example : I have a form to search the database. Visitors enter the lowest price they would like to get, and in another field, the highest price they would like to get.

From this, I know I can run search.cgi in order to handle one of these two prices, and then sorting the results (DESC or ASC).

But, do you know if I can run search.cgi in order to take care of these two prices ?

At the top of the results page, I would like to show the entries with the highest price the visitor entered, and at the bottom, the entries that are near to the lowest price the visitor entered in the form.

I hope you understand what I mean Smile.

Thank you all for your help !

Regards,

Gautier.
Quote Reply
Re: [Gautier] Prices to sort In reply to
Ok, please go here : http://www.gossamer-threads.com/perl/dbsql/db.cgi?db=homes&do=search_form&uid=default

In fact, this is what DBMan SQL does. You have a form "Priced from:" >> "To:"

Does somebody know how can I do that with Links SQL ?

Thank you !

Regards,

Gautier.
Quote Reply
Re: [Gautier] Prices to sort In reply to
Hi,

I am not sure if you can do this from the command line of the search.cgi, I am sure that is what you are looking for.

If there isn't a solution you could always turn to a global/function which uses GT's condition to return a set of results... may do some complex sorting and so on...

$cond = GT::SQL::Condition->new( 'Price, '>', $from, 'Price', '<', $to );


http://www.iuni.com/...tware/web/index.html
Links Plugins

Last edited by:

Ian: Jul 1, 2002, 12:23 PM
Quote Reply
Re: [Ian] Prices to sort In reply to
Hi Ian,

Thank you for your help. Yes I would like to use this from the command line of search.cgi, so I'm not sure your solution would work ?

If it could, how can I use it from the search.cgi command line ?

I have catched this thread :

http://www.gossamer-threads.com/...sort%20price;#186195, but unfortunately it doesn't explain how can I "cut" the lower results according to what users want.

Thanks again from France,

Gautier.
Quote Reply
Re: [Gautier] Prices to sort In reply to
To actually sort all the links by price, lowest first, try adding 'PriceField' in the setup (Setup > Build Options), the field is build_sort_order_category, change it to something like;

PriceField, isNew DESC,isPopular DESC,Title

That should sort by price first, and then by the rest of the fields.

If you are trying to do the search in order of price, just do something like;

search.cgi?query=word&PriceField=<12.32

or something similar to that Tongue

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Gautier] Prices to sort In reply to
Yeah I see what you mean.... you don't seem to be able do a 'between' with any one column. Maybe you can but I don't see it.

I guess you have seen the docs also:

Quote:
Options:
- paging
mh : max hits
nh : number hit (or page of hits)
sb : column to sort by (default is by score)


- searching ww : whole word ma : 1 => OR match, 0 => AND match, undefined => QUERY substring : search for substrings of words bool : 'and' => and search, 'or' => or search, '' => regular query query : the string of things to ask for

- filtering field_name : value # Find all rows with field_name = value field_name : ">value" # Find all rows with field_name > value. field_name : "<value" # Find all rows with field_name < value. field_name-gt : value # Find all rows with field_name > value. field_name-lt : value # Find all rows with field_name < value.[/quote]



Have you tried filtering with both greater than and less than values?


It wont let me paste that part of the docs for some reasonCrazy


http://www.iuni.com/...tware/web/index.html
Links Plugins

Last edited by:

Ian: Jul 1, 2002, 12:45 PM
Quote Reply
Re: [Ian] Prices to sort In reply to
How about...

?query=blah&Price-gt=50.00&Price-lt=100.00

Maybe that will work like betwen...not sure.
Quote Reply
Re: [Paul] Prices to sort In reply to
Ian, Andy, Paul...

How can I work without you guys ?

I do think it is impossible...

Doh ? Oh ! WoooooHoooooooo !!!! SmileSmile

I didn't think we could use so much matching criteria with Links SQL !

It works like a charm now. Many of your solutions work Sly.

But the next time, I'll read the entire documentation before posting here Blush.

Many thanks, and thanks again guys...

Best Regards from France,

Gautier.