1

Following updates to PHP 7.3.29 and MySQL 5.7.34 earlier this month, we discovered that discounts are no longer being automatically applied to event registration forms, public or back-end. The discount codes do work when applied manually. No errors are being logged. We just updated CiviDiscount to 3.8.2 from an older version, but that did not resolve the problem. We are on CiviCRM 5.33.5 on Drupal 7.81. Any ideas what might be causing this? Thanks very much.

4
  • might be worth seeing if you can replicate on dmaster.demo.civicrm.org
    – petednz - fuzion
    Commented Jul 27, 2021 at 3:38
  • I did a test on demo and it worked fine. It is also on PHP 7.3.29. I wonder if some other extension we are using might be a factor.
    – Larry K.
    Commented Jul 27, 2021 at 14:52
  • This appears of be a version compatibility issue, as price sets that were created before 2018 still display properly. If I copy or try to update an old price set, they stop displaying the discounts.
    – Larry K.
    Commented Jul 29, 2021 at 16:32
  • 1
    I have submitted this as a possible issue with price sets: lab.civicrm.org/dev/core/-/issues/2727
    – Larry K.
    Commented Jul 29, 2021 at 21:42

1 Answer 1

2

I was able to get this working with this reversal of logic in cividiscount.php: This seems to function properly on CiviDiscount 3.7 on our production server:

- if ($autodiscount) {
-        break;
+ if (!$autodiscount) {
+        continue;

We are still experiencing the puzzling issues mentioned below on our dev server with CiviDiscount 3.8.4. Hopefully someone familiar with the code will be able to work through this and determine what the issue is.

3
  • I am now noticing some additional strange behavior on our dev server with CiviDiscount 3.8.4. If I go to edit existing discounts from the last few years, the previously selected price sets in the Discounts for Events field are no longer displayed and price sets for events in the last few years no longer appear in the pick list and there are some blank lines instead. I rebooted the server just in case something was hung, and there is no change.
    – Larry K.
    Commented Aug 3, 2021 at 3:14
  • This appears to have worked for me, with autodiscounts still otherwise not always working in CiviDiscount 3.8.8.. I also noted that the issue referred to in an earlier comment - lab.civicrm.org/dev/core/-/issues/2727 has been autoclosed by a housekeeping bot with no action taken to resolve the issue.
    – Graham
    Commented Jan 24 at 14:35
  • From the comment from Eileen in the linked issue it seems that a fix may be on the way. In the interim my autodiscounts work with the tweak from @larry-k
    – Graham
    Commented Mar 20 at 16:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.