Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-8474

Allow Multiple Membership Blocks for Online Contribution Pages

    Details

    • Type: New Feature
    • Status: Done/Fixed
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: 3.4.4, 4.0.4
    • Fix Version/s: 3.4.6, 4.0.6
    • Component/s: CiviMember
    • Labels:
      None

      Description

      Currently, only a single block containing 1 or more membership types can be offered for self-service membership signup and renewal on a given Online Contribution Page. Some organizations need to offer more than one membership block per page, with the ability to select whether they are compulsory or optional. For example a page may require that people sign-up for a Regional body membership but also have an optional block for national body membership and one for international body membership. A separate membership record would be created for each.

      ==========
      DB Changes
      ==========
      No database schema changes are required for this implementation. Online contribution pages configure with > 1 membership block will have multiple rows in civicrm_membership_block pointing to the same contribution page id.

      =============
      Implementation
      =============
      1. Configure Contribution Page : Memberships form (CRM/Member/Form/MembershipBlock,php)
      Each membership block will have the same set of properties (e.g. each block has a 'new' and 'renewal' title and message, a required property, etc.). We can follow the same UI model used for editing multiple address blocks in the Contact edit form and inject a new fieldset for each block to be configured.

      1.1 Build the form

      • Enclose all existing fields on this form in a fieldset (other than the initial 'enable' checkbox).
      • Place a button - 'Another Membership Block' (same markup as 'Another Address') at the bottom of the fieldset.
      • Clicking that button loads another fieldset with membership block fields with legend = 'Additional Membership Block'. We will allow N blocks, so the 'Another Membership Block' button is present at the bottom of each injected fieldset.
      • Any block after the first block will also have a link in upper right corner 'Delete this membership block'. (Again, same pattern as address editing.)
      • One fieldset should be displayed or each configured block when the form is rendered.

      1.2 Form rules

      • In order to avoid additional complexity in the postProcess code, we should NOT allow 'Separate Membership Payment' when > 1 membership block is configured (is_separate_payment checkbox). Form Rule error: "Separate Membership Payment option is not currently supported if more than one membership block is enabled."
      • Don't allow the same membership type to be included in multiple blocks. "You can not include the same membership type in multiple membership blocks."

      1.3 Post process
      Create / update a membership_block row for each block defined in the form.

      2. Online Contribution Pages (CRM/Contribute/Form/Contribution/Main.php, Confirm.php, Thankyou.php)
      2.1 Main contribution form (Main.php)

      • Currently, we include a <div id="membership"> for the membership block. When additional blocks are defined, repeat the markup structure in the form - but ensure unique HTML id's by appending "block$N" to each id (e.g. 2nd block would be enclosed in <div id="membership-block-2">, it's intro message enclosed in <div id="membership-intro-block-2"> etc.
      • Preprocess needs to check for existing membership(s) matching membership types in each block:
          • If existing membership, select that membership type radio button by default, use the 'renewal' title and intro message, and include status message next to membership type ("Your General membership expires on July 10th, 2013.").
      • Form rule uses is_required property for each block to determine which membership block(s) need to have a membership type selected.

      2.2 Confirm page

      • Display the membership block (read-only). If more than one membership has been selected, list them w/ their descriptions (as available) in the membership-group section. List each membership fee and the Total in the amount_display-group section (extending what we already do when there is a membership free AND a contribution).

      2.3 Post Process

      • When multiple memberships are selected, we still post a single financial transaction (to the processor) for total of all membership fees and create a corresponding contribution record. Multiple memberships link to the single contribution record using civicrm_membership_payment join table. Assign membership statuses appropriately for all created / updated memberships.
      • Confirmation receipt should include a line item for each membership / fee along w/ a total line (when > 1 membership is purchased). System workflow message templates for online and offline membership signup and renewal will probably need some changes.

      2.3 Thankyou page
      Same display changes as Confirm page.

      ========
      Upgrades
      ========
      Assuming there are system workflow message template changes for online and off-line membership receipts, they will need to pushed out during upgrade using the same approach as done for 3.4.5.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                dgg David Greenberg
                Reporter:
                dgg David Greenberg
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: