Found something that seems to be working, though I made one tweak to the output filter.
Everett had done a post at:
I created this snippet. (note: initially it gave me an error about unexpected '<' on line two. I went into my snippet code and put a line space just after the <?php
$number = floatval($input);
$optionsXpld = @explode('&', $options);
$optionsArray = array();
foreach ($optionsXpld as $xpld) {
$params = @explode('=', $xpld);
array_walk($params, create_function('&$v', '$v = trim($v);'));
if (isset($params[1])) {
$optionsArray[$params[0]] = $params[1];
} else {
$optionsArray[$params[0]] = '';
}
}
$decimals = isset($optionsArray['decimals']) ? $optionsArray['decimals'] : null;
$dec_point = isset($optionsArray['dec_point']) ? $optionsArray['dec_point'] : null;
$thousands_sep = isset($optionsArray['thousands_sep']) ? $optionsArray['thousands_sep'] : null;
$output = number_format($number, $decimals, $dec_point, $thousands_sep);
return $output;
Then on my tv placeholder in my output chunk for pdoResources, I did the following.
Changed:
To:
[[+tv.propPrice:numberformat=`&decimals=0&dec_point=.&thousands_sep=,`]]
The one change I made to the string is to swap the dot and the comma. Everett had dec_point=, and thousands_sep=.
Not sure whether I can pare down the string or not. I only need commas, and I don't quite understand want is meant by one, two or four in the php manual.
Perhaps I can get away with only the one?
[[+tv.propPrice:numberformat=`&thousands_sep=,`]]
At any rate. Items are sorting correctly based on price, and then getting commas added to the source code output. 2 days and a lot of frustration for numerically sorting items. I was gettin' close to sorting these by house color instead.