CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMember (Moderator: Deepak Srivastava) »
  • Problems with Premiums
Pages: [1]

Author Topic: Problems with Premiums  (Read 2945 times)

Max Hunter

  • I’m new here
  • *
  • Posts: 21
  • Karma: 1
  • CiviCRM version: 4.4.x
  • CMS version: Drupal 7
Problems with Premiums
February 20, 2013, 05:49:47 pm
Hi All!

I'm running into some trouble setting up premiums on the contribution page I'm building for membership sign-up and renewal.  I was hoping you could help me figure out whether this is a bug caused by me screwing up somewhere in installation/configuration, or just functionality that didn't exist way back in 4.1.

Premiums work beautifully on my contribution pages that manage giving levels through the "Contribution Amounts" section, restricting the choice of premium based on whether the contribution level meets the minimum amount.  But when I set up giving levels through "Membership Price sets", Civi has no problem approving the $500 premium for a member renewing at $12.

My payment processor is Stripe, and I'm running 4.1 in Drupal.  Is something wrong, or do I just need to upgrade to get the functionality I'm describing?  Thank you so much!

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Problems with Premiums
February 20, 2013, 06:49:22 pm
Max - I 'think' premium giving level controls with price sets are working in the latest version but haven't tried them myself. Would be great if you could do a quick test on the 4.3 sandbox (or 4.2 public demo) and report back.

http://sandbox.drupal.civicrm.org/
Protect your investment in CiviCRM by  becoming a Member!

flug

  • I post frequently
  • ***
  • Posts: 126
  • Karma: 12
Re: Problems with Premiums
July 11, 2013, 02:20:36 am
Here is the solution for CiviCRM 4.2.  I'm not sure if this problem still exists in 4.3 or existed in 4.1, but the issue is that the code was checking to see if the "Amounts Block" was enable in the contribution form, and if it was not enabled then it didn't check the premium minimum donation.

So if you're using a price set--or just a membership level with no Amounts Block enabled--your users could select any premium at all.

The fix is in CRM/Contribute/Form/Contribution/Main.php around line 998:

Original:
Code: [Select]
    if (isset($fields['selectProduct']) &&
      $fields['selectProduct'] != 'no_thanks' &&
      $self->_values['amount_block_is_active']
    ) {
      $productDAO = new CRM_Contribute_DAO_Product();
      $productDAO->id = $fields['selectProduct'];
      $productDAO->find(TRUE);
      $min_amount = $productDAO->min_contribution;

Fixed:
Code: [Select]
    if (isset($fields['selectProduct']) &&
      $fields['selectProduct'] != 'no_thanks'
      //&& $self->_values['amount_block_is_active']
    ) {
      $productDAO = new CRM_Contribute_DAO_Product();
      $productDAO->id = $fields['selectProduct'];
      $productDAO->find(TRUE);
      $min_amount = $productDAO->min_contribution;

I haven't tested this super-extensively but it should work.  If you've selected a premium other than 'no thanks' it should always check the minimum premium against your total, and that is what the code above does.

flug

  • I post frequently
  • ***
  • Posts: 126
  • Karma: 12
Re: Problems with Premiums
July 11, 2013, 02:25:36 am
FYI, this problematic code still exists in Civicrm 4.3--see Main.php line 901.

It may be that the new ajax-y method of showing which premiums are available means this bug is not exposed in 4.3, but it's still there . . .  I'll post a bug report.

Edit: Incorrectly said the bug *is* exposed in 4.3, corrected to say the bug *is not* exposed in 4.3.  I think in fact it is not exposed (under normal circumstances) because of the new ajax-y way of showing premiums, but if definitely is still there under the hood.
« Last Edit: October 06, 2013, 06:34:57 pm by flug »

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Problems with Premiums
August 22, 2013, 07:10:23 pm
http://issues.civicrm.org/jira/browse/CRM-13034
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMember (Moderator: Deepak Srivastava) »
  • Problems with Premiums

This forum was archived on 2017-11-26.