dariusj has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to sort a hash of hashes of the form { 1 => { customer_class_id => 1, discount => "0.000", name => "None" }, 2 => etc. } by name alphabetically in template toolkit.
I currently have this:
[% FOREACH category_id IN category.keys.sort($category_id.name) %] [% IF category.$category_id.customer_class_id == class_id %] <option value="[% category_id %]">[% category.$category_id.nam +e %]</option> [% END %] [% END %]
Everything's displaying fine but it's not sorting correctly!
Any tips please?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Sort a hash of hashes by value in template toolkit
by Somni (Friar) on Nov 16, 2007 at 15:15 UTC | |
by dariusj (Sexton) on Nov 19, 2007 at 11:50 UTC | |
by szodjo (Initiate) on Feb 28, 2008 at 20:03 UTC | |
|
Re: Sort a hash of hashes by value in template toolkit
by jbert (Priest) on Nov 16, 2007 at 12:34 UTC |