fix price field options to display all options
Created by: MegaphoneJon
Steps to replicate
- Create two price field sets, "Set 1" and "Set 2".
- In Set 1, create two price fields, "Apple" and "Carrot".
- In Set 2, create two price fields, "Banana" and "Daikon".
- Assign each price set to an active event.
- Create a new discount.
- Click on the Select2 for Price Field Options.
Expected Result
Actual Result
This happens because this Select2 is populated by a function getNestedPriceInfo()
. This takes a list of price fields and nests them by price set label. However, if you have the same price set more than once, only the last one is available in the Select2. So you must sort the price field labels first by price set info.
I considered modifying the SQL instead of sorting in PHP, but this would ruin the order for the other function that calls getPriceSetInfo()
.
Merge request reports
Activity
Created by: MegaphoneJon
Thanks @herbdool. I should've been clear that my concern wasn't "this is happening" but "I wrote my patch in such a way that I didn't need to check these things because I'm lazy". If no other displays are affected, I'm happy to use your PR in preference to mine.
cc @JonGold (import didn't map username, just keeping you in the loop for notifications)
mentioned in issue #286 (closed)
Closing as the problem was solved by !270 (merged)