Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Re: [socrates] Allow sorting links dynamically by price via category.html and search.cgi

Quote Reply
Re: [socrates] Allow sorting links dynamically by price via category.html and search.cgi In reply to
Hi,

You could try changing:

return search() if ((defined $args->{query} and $args->{query} =~ /\S/) || $args->{catid} =~ /^\d+$/);

to

Code:
return search()
if (
(defined $args->{query} and $args->{query} =~ /\S/)
||
$args->{query} eq "*"
||
$args->{catid} =~ /^\d+$/
);

to see if that helps. Then pass in query=* to make it do a search. If that doesn't work, I'll need to look deeper.

Quote:
The sorting itself does not seem work well because of commas in the price values - hence, I thought we might need a global or something so it sorts the values ignoring the commas - in the future I plan to add a javascript in the form so users submit commas in price values, it will reformat before submitting the price value to the database.

Or better yet, add another field (basic FLOAT field), and do something like:

Code:
UPDATE glinks_Links SET New_Field = REPLACE(Current_Price_Field,",","")

Or better yet, would be to STORE the data *without* any comma's in, and then use my Commify() function in ULTRAGlobals to format it only when you need to show it with commas.

Cheers

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!
Subject Author Views Date
Thread Allow sorting links dynamically by price via category.html and search.cgi socrates 5017 Mar 25, 2017, 7:55 PM
Thread Re: [socrates] Allow sorting links dynamically by price via category.html and search.cgi
Andy 4887 Mar 26, 2017, 6:30 AM
Thread Re: [Andy] Allow sorting links dynamically by price via category.html and search.cgi
socrates 4876 Mar 27, 2017, 11:18 PM
Post Re: [socrates] Allow sorting links dynamically by price via category.html and search.cgi
Andy 4871 Mar 27, 2017, 11:33 PM
Thread Re: [socrates] Allow sorting links dynamically by price via category.html and search.cgi
el noe 4856 Mar 30, 2017, 7:06 AM
Post Re: [el noe] Allow sorting links dynamically by price via category.html and search.cgi
socrates 4591 Apr 24, 2017, 9:07 PM