Skip to content
Snippets Groups Projects

fix price field options to display all options

Closed 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
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • @MegaphoneJon does #270 solve the issue for you?

  • Author Owner

    Created by: MegaphoneJon

    @colemanw I'll investigate when I have a minute - but @herbdool what do you think about my concern that changing the SQL ruins the order for other functions that call getPriceSetInfo()?

  • @MegaphoneJon I hadn't considered it. Where does it appear in the UI? Does it look weird with my PR? (I'll take a look myself next time I can check a site)

  • So I looked at the output when viewing an individual discount. I don't see any difference before and after my patch. So perhaps it's fine?

  • Author Owner

    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.

  • bgm restored source branch github/fork/MegaphoneJon/fix-price-field-options

    restored source branch github/fork/MegaphoneJon/fix-price-field-options

  • Author Owner

    cc @JonGold (import didn't map username, just keeping you in the loop for notifications)

  • colemanw mentioned in issue #286 (closed)

    mentioned in issue #286 (closed)

  • Closing as the problem was solved by !270 (merged)

  • closed

  • colemanw changed the description

    changed the description

Please register or sign in to reply
Loading