Forum

Thread tagged as: Question, Shop

Sort with numbers

Hello,

I have a list of 12 products and need to give to my client a way to decide which product goes to position 5 and position 9. I don't think there is a way to do that, so I thought of giving her a select field (id="position") with options from 1 to 12 and sort using this field. I then change the template based on this field's value. The problem is, as far as I understand, that 'sort' => 'position' treats the values as strings instead of numbers which doesn't give the desired output. How can work around this behaviour?

Proko Mountrichas

Proko Mountrichas 3 points

  • 3 years ago
Duncan Revell

Duncan Revell 78 points
Registered Developer

sort-type Either alpha or numeric. Default is alpha.

From: https://docs.grabaperch.com/functions/content/perch-content-custom/

Fantastic, I'd missed this one. Thanks a lot Duncan!