Invision Community 5: A video walkthrough creating a custom theme and homepage By Matt Thursday at 04:02 PM
A Zayed Posted February 13, 2019 Posted February 13, 2019 I don't think this is possible without downloads_files table modification, this is because prices are json encoded.
SJ77 Posted February 13, 2019 Author Posted February 13, 2019 35 minutes ago, A Zayed said: I don't think this is possible without downloads_files table modification, this is because prices are json encoded. Rule number 1 of fight club never mention fight club Rule number 2..never alter the original IPS tables. DawPi and A Zayed 1 1
TheJackal84 Posted February 14, 2019 Posted February 14, 2019 8 hours ago, SJ77 said: Rule number 1 of fight club never mention fight club Rule number 2..never alter the original IPS tables. Commerce allows a price filter in 4.4, maybe IPS will add it to the downloads app????? SJ77 1
SJ77 Posted March 7, 2019 Author Posted March 7, 2019 Trying to get someone started I have an idea. Looking at how prices are stored in a long string, seems the "plain" price is always the 3rd index in that file cost array. Couldn't the query be written to sort on just that value using some string logic? It would be an ugly query but I think it could work. start position use Use CHARINDEX(substring, string, start) to find 'amount' end position use CHARINDEX(substring, string, start) to find 'currency' then you have the start and end position and you can grab the amount and sort on it using SUBSTRING(string, start, length) Something like as follows. select (substring(file_cost,charindex(file_cost,'amount":"',1),(charindex(file_cost,'","currency',1)-charindex(file_cost,'amount":"',1))) as plain_price where validatepermissions = true sort desc on plain_price That query won't work but I think it gives someone the idea. I think with some adjustments this could work much easier and allow sorting on the fly with no extra columns or table conversions etc. Jaymez 1
Recommended Posts