Ok, so this requires a few separate things:
1) The full list of tiddlers you are working with. This should be defined by a filter.
2) The first sorting criteria. We will go with the first tag listed since that is what you mentioned. Just be aware that this part is almost as complex as the rest of what you asked for all by itself. Luckly, I am magic and may be at the start of one of my hypomanic episodes. MAGIC!!
3) The second sorting criteria, we will go with sorting numerically by the value is the 'ordering' field
Note: If you have double quotes in a tiddler of tag name than it won't work correctly.
I have my doubts that this will ever be useful. You may be able to make it work with one button but I don't think so. Put in your filter for all the tiddlers and give the field you want to base the second sort on. If you want to sort by something other than the first tag than you may have to do that yourself.
\define OPEN() [[$(ThisTiddler)$]]
\define SecondFilterThing() $(FullListOfTiddlers)$+[tag<SortedTagList>nsort{$:/temp/FilterToSort!!secondsort}]
\define InnerThing()
<$list filter='[list[$:/temp/FancyShmancySortingMagic##$(currentTiddler)$]]' variable=ThisTiddler>
<$action-listops
$tiddler='$:/temp/FancyShmancySortingMagic'
$index=OutputList
$subfilter='+[append<OPEN>]'
/>
</$list>
\end
Give me a filter:
<$edit-text tiddler='$:/temp/FilterToSort' field='filter' class='tc-edit-texteditor'/>
Second sort field:
<$edit-text tiddler='$:/temp/FilterToSort' field='secondsort' class='tc-edit-texteditor'/>
<$set
name=FullListOfTiddlers
value={{$:/temp/FilterToSort!!filter}}
>
<$button>
Fancy Shmancy Sorting Magic 1
<$list
filter=<<FullListOfTiddlers>>
>
<$list
filter='[<currentTiddler>list[!!tags]first[]]'
variable=ThisTag
>
<$action-listops
$tiddler='$:/temp/FancyShmancySortingMagic'
$index=TagList
$subfilter='+[append<ThisTag>]'
/>
</$list>
</$list>
</$button>
<$button>
Fancy Shmancy Sorting Magic 2
<$list
filter='[list[$:/temp/FancyShmancySortingMagic##TagList]sort[]]'
variable=SortedTagList
>
<!--!<<SortedTagList>>-->
<$list
filter=<<SecondFilterThing>>
variable=ThisTiddler
>
<!--<<ThisTiddler>>-->
<$action-listops
$tiddler='$:/temp/FancyShmancySortingMagic'
$index=<<SortedTagList>>
$subfilter='+[append<OPEN>]'
/>
</$list>
</$list>
</$button>
</$set>
<$button>
Fancy Shmancy Sorting Magic 3
<$list filter='[[$:/temp/FancyShmancySortingMagic]indexes[]bf[]]'>
<<InnerThing>>
</$list>
</$button>
Output:
<$list
filter='[list[$:/temp/FancyShmancySortingMagic##OutputList]]'
>
</$list>