Forum for discussing general topics related to Couch.
8 posts Page 1 of 1
Hi all, I have across this peculiar issue:

Let`s say I have a bunch of cloned pages of some products, which have their respective prices or courses, which have some capacity (and hence a number of occupied and free slots) ... and would like to offer sorting these pages by those criteria.

Sorting by product name, lecturer name, etc. is easy, but what about the number? Provided it is actually a text variable, simple
Code: Select all
<cms:pages masterpage='masterpage.php' orderby='my_price' order='asc' >

sorts it alphabetically, so the order would be 1000 - 2500000 - 3000 - 400, etc. I tried decimal dots in the admin, tried
Code: Select all
<cms:number_format "<cms:show kurz_cena />" decimal_precision='0' />

and have also seen a brief explanation at viewtopic.php?f=4&t=10064, but still no do. How do I make Couch consider the string a number, so that I can use it in the <pages...> tag, please? I understand a <capture> may not help here...

Thanks in advance!

Please see 'search_type' param of <cms:editable> - ... earch_type

Hope it helps.
Perfect, thanks a lot! / I was looking at that too, no doubt, it only did not occur to me that it also pertains to the editable as such.
You are welcome :)
Relatedly, tho, would there be an easy way to switch different sorting of the cloned pages (by author, price, lecturer...) by clicking a front-end button? What comes to mind is javascript toggling different divs with particular ordering, but if I am missing something obvious, a hint would be much welcome.
Perhaps the following (a part of the 'Advanced Tutorial') would give you some hints? ... -view.html
KK wrote: Perhaps the following (a part of the 'Advanced Tutorial') would give you some hints? ... -view.html

Notejam genuinely scares me. :D But perhaps this is a good use case to look into. Or I will stick with Isotope filtering. In every case, thanks!
Try datatables with their front-end based sorting if the number of records is not in thousands. Also covers the next obvious request to filter some records.
8 posts Page 1 of 1