Stash
ExpressionEngine 2, ExpressionEngine 3, ExpressionEngine 4, ExpressionEngine 5, ExpressionEngine 6
Back to this add-on's main page
View Other Add-ons From Mark Croxton
Stash EE2 - orderby/sort not working with multiple values
Support Request
Chad Crowell
|
Posted: 28 June 2018 03:58 PM |
|
|
|
Hi Mark, working on an old site here. I’ve got a list of data coming out of a playa field. Stash get_list and set_list are working great, but the sorting seems to be of issue.
Here is my code:
{exp:stash:set_list name="docs" parse_tags="yes" parse_depth="2"} {cf_product_documents} {stash:doc_file}{cf_product_document_file}{/stash:doc_file} {stash:doc_type}{exp:gcx:get_doc_name name='{cf_product_document_type}' lang='{nsm_lang}'}{/stash:doc_type} {stash:doc_name}{if nsm_lang != ''}{cf_product_document_title{nsm_lang}}{if:else}{title}{/if}{/stash:doc_name} {/cf_product_documents} {/exp:stash:set_list}
{exp:stash:get_list name="docs" orderby="doc_type,doc_name" sort="asc,asc"} <dt><a href="{doc_file}" target="_blank" onclick="ga('send', 'pageview', '{doc_file}');" title="{doc_name}">{doc_type}</a></dt> <dd>{doc_name}</dd> {/exp:stash:get_list}
Notice I am sorting and ordering by 2 values of the list. If I remove either one, and sort by just doc_type or doc_name, the sorting works. But here is what I get with the code above:
https://d.pr/i/AO5Fto
Here is the stashed data:
Stash: SET docs to value doc_file|=|/assets/documents/datasheets/VHM-PL_Datasheet.pdf|&|doc_type|=|Datasheet|&|doc_name|=|VHM-P and VHM-PL Variable Height Arm|+|doc_file|=|/assets/documents/installation_guides/DU-WS-0012-09_Rev_C.PDF|&|doc_type|=|Installation Guide|&|doc_name|=|DU-WS-0012-09C VHM-P (Non-Locking) VHM Arm with VESA Mounting Plate for 75x75mm or 100x100mm apps|+|doc_file|=|/assets/documents/installation_guides/DU-WS-0012-109_Rev_C.PDF|&|doc_type|=|Operation Guide|&|doc_name|=|DU-WS-0012-109C VHM-P (Non-Locking) Variable Height Arm Operation Guide|+|doc_file|=|/assets/documents/installation_guides/DU-WS-0012-29_Rev_A.pdf|&|doc_type|=|Installation Guide|&|doc_name|=|DU-WS-0012-29 VHM-P with 8”/20.3 cm or 14”/35.6 cm Extension and VESA Mounting Plate for 75 x 75mm or 100 x 100mm App|+|doc_file|=|/assets/documents/installation_guides/DU-WS-0012-129_Rev_A.pdf|&|doc_type|=|Operation Guide|&|doc_name|=|DU-WS-0012-129 VHM-P with 8”/20.3 cm or 14”/35.6 cm Extension and VESA Mounting Plate for 75 x 75mm or 100 x 100mm App|+|doc_file|=|/assets/documents/installation_guides/DU-FLP-0008-12RevB.pdf|&|doc_type|=|Installation Guide|&|doc_name|=|DU-FLP-0008-12 Flat Panel Handle Instructions|+|doc_file|=|/assets/documents/installation_guides/DU-WC-0002_Rev_C_1.pdf|&|doc_type|=|Installation Guide|&|doc_name|=|DU-WC-0002 Wall Channel Instructions
I’ve tried adding sort_type=“lowercase,lowercase” and also process=“end” but neither changed anything. Any ideas?
|
|
|
Mark Croxton
|
Posted: 29 June 2018 05:04 AM |
# 1
|
|
Developer
|
Hi Chad
I think you just need to use pipe | as your delimiter rather than commas.
See: https://github.com/croxton/Stash/wiki/{exp:stash:get_list}#multiple-orders-and-sorts
|
|
|
Chad Crowell
|
Posted: 29 June 2018 11:12 AM |
# 2
|
|
|
Ah - I was staring right at it! Facepalm! Thanks Mark, I hope you are doing well.
|
|
|