Membership Price Sets

Published
2009-04-17 14:02
Written by
chrisivens - member of the CiviCRM community - view blog guidelines
I had to add some price sets to our recent project and I think I managed to get both the existing system and the price set system to work side by side. To give you an idea of why I had to do it, think of this; you have a specific membership open to organisations, the amount that the organisation needs to pay to join is based on its size. A company of 2-4 people will pay less than a 300+ employee company. How did I do it? I added a system similar (and borrowed code) from the events system. I used the custom fields and not the price sets as defined in events. When I had the prices available I had to implement a complicated radio button system (complicated in code not usability) to get the price chosen. This means that if a price set is available, it will be shown and can be selected as a sub set of the main membership options. I guess the best thing to illustrate this may be a picture. We haven't finished the theme yet so here is a VERY small glimpse of what we have set up.
Filed under

Comments

I know it's a comment on my own post but I'd just like to say something about the code needed to do this. I thought it was going to be a lot more work but credit where it's due, most of the raw material was there to do this. If needed I can provide full code on my changes but I'd say that it would be too much to go into here.

This looks great -- a functionality that I've been hoping for. Were you able to retain the full flexibility of the event price sets? So there can be unlimited number of fields using different field types? Also, do you have it working in both the front and backend?

How does it process the records -- multiple inserts into the membership table, and a single contribution record?

...very interested.

This looks like a nifty solution to a requirement that I have as well.

Any more detail on how the magic was weaved?

Daragh

Being able to offer membership uplifts via price sets has long been a major stumbling block. CiviMember is long due a phase two rework and this code would be a fantastic inclusion. Just wish I was a coder who could offer the project more. I realize that many of the other new features and modules that have been added over the last couple of years enhance the whole solution but I can wholeheartedly give my vote for a CiviMember overhaul.

Nice one!

I'll have to write something a little more in-depth and hopefully add a patch file for anyone interested. I run v2.1 so I will have to focus on this for the post but much of what I write will transfer to 2.2+ I reckon. If anyone wants to step up and help produce a patch for 2.2 then let me know. It's a volunteer thing so I only have so much time until the wife moans :)

Things are looking promising for this to make Core in 2.3 too.