Skip to content

fix price field options to display all options

bgm requested to merge github/fork/MegaphoneJon/fix-price-field-options into master

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

Selection_1159

Actual Result

Selection_1158

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().

Edited by colemanw

Merge request reports

Loading