3

We are working in civiCRM 4.6.4 with Drupal 7.50.

Our goal is to have a report template where one can pull up a list of event participants (possibly for multiple events) who used a specific discount code and/or all participants who used a discount code for a specific event(s).

Some of our discount codes (automatic member discount etc) are used over the course of multiple events so the users list available from the civiDiscount admin page doesn't really accomplish this well for us.

A quick google search did not turn up an example report form for me to follow - nor do I see this in the 'extended reports' extension.

I see that the participant table seems to have discount_id and discount_amount columns, but when I inspect those columns in mysql I see all null and when I try a participant get with the API I get weird results when using those as parameters so maybe that won't work?

My next thought was to look at fee_level because participants seem to have the discount codes inserted into the fee level text. I thought I might add an additional participant_fee_level filter and title it 'discount code' with a 'like' operator to allow searching on discount code.

While this functionally works, I am wondering if there is a better solution as this one seems a bit rough. An example would be if someone wants to pull up all discount codes used for an event they need to know to fill the field with the value 'Discount' or '(', which pull up the same list. Also the 'starts with', 'ends with', '=', '!=', 'null', 'not null' options for the 'like' operator would not function as the user would expect.

Any thoughts on whether this is the best solution for now or there is a better (attainable) way to proceed are much appreciated!

  • Hey @eli - Did you ever build something like this? If so, could you let me know either here, or on chat.civicrm.org (I'm "junglebird" there)? Thanks! – Jon G - Megaphone Tech Jun 5 '17 at 20:02
  • For anyone who finds this... I replied to Jon on mattermost because my answer was longer than a comment. TLDR; I never quite got this working better than what is described above before priorities changed at our org. – Eli Lisseck Jun 7 '17 at 16:02
  • @jon-g If you're still looking at this, the need has come back at this org and I will be working on this this afternoon / early next week depending on whether it plays nice or not :) – Eli Lisseck Jun 30 '17 at 16:29
  • Thanks for the heads-up! I received an inquiry from another Civi shop about this conversation recently, too. – Jon G - Megaphone Tech Jun 30 '17 at 18:13
  • @jon-g What I ended up with so far is a clone of the "Event Income (detail)" summary report which also gives you stats for discount codes used per event. I packed it up quickly at github.com/elisseck/com.elisseck.discountreport so you can check it out. Ideally I would get a clone of "Event Participants List" with discount info going, but that has proven to be much, much more difficult. I don't think I know enough about the fancy 'where()' stuff going on to get it working in a reasonable amount of time right now. – Eli Lisseck Jul 6 '17 at 20:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.