Upcoming Events
NYC CiviCRM Meetup - September 7th
September 7th, 2010
This next NYC meetup will feature a case study or 2, a look at what's new in (more...)
Configuring, Customizing and Extending CiviCRM - New York
September 16th, 2010
This comprehensive two-day hands on training course is targeted at (more...)
CiviCRM User and Administrator Training - New York
September 16th, 2010
A comprehensive two day hands on training course covering the configuration, (more...)
CiviCRM Code and Test Sprint - New York
September 18th, 2010
This code and test sprint is targeted at experienced developers who want to (more...)
CiviCRM Toronto Meetup
September 21st, 2010
Come meet others from the Toronto Area who are interested in, using or (more...)
CiviCRM Philly Meetup – September 2010
September 23rd, 2010
Come meet others from the Philadelphia Area who are interested in, using or (more...)
CiviCRM Seminar - Dublin
September 28th, 2010
NfP Services are hosting a free seminar at The IBOA, Stephen St Upper, Dublin 8 (more...)
London developer and implementer training
September 30th, 2010
This comprehensive two-day hands on training course is targeted at implementers, (more...)
London user and administrator training
September 30th, 2010
A comprehensive two day hands on training course covering the configuration, (more...)
Berlin user and administrator training
October 6th, 2010
A comprehensive one day hands on training course covering the configuration, (more...)
Berlin developer and implementer training
October 7th, 2010
This comprehensive one-day hands on training course is targeted at implementers, (more...)
Benelux meetup in Brussels: Connect, communicate and activate your supporters and constituents
October 11th, 2010
Come meet others who are interested in, using or developing for CiviCRM. For (more...)
CiviCRM Toronto Meetup
October 19th, 2010
Come meet others from the Toronto Area who are interested in, using or (more...)
CiviCRM Toronto Meetup
November 16th, 2010
Come meet others from the Toronto Area who are interested in, using or (more...)
New in 2.2: State-Country widget, customizing event registration amounts for members
- Not Just a Contact Database
-
These optional components give you more power to connect and engage your supporters.

civiCONTRIBUTE
Online fundraising and donor management.

civiEVENT
Online event registration and participant tracking.

civiMEMBER
Online signup and membership management.

civiMAIL
Personalized email blasts and newsletters.

civiREPORT
Report generation and template management.
Our global meeting resulted in some new features being added to 2.2. Our team worked on a new jQuery based country/state selector and incorporating hook(s) to the "amount" functionality of online contribution and event registration pages. I'll give a brief description of the feature set and functionality of these projects
New jQuery based State Country widget
Our previous widget was a dojo based combo box widget. Both the country and the state were ajax based combo boxes. The state combo box was dependent on the value chosen in the country combo box. This implementation was quite complex and not easily replicated (hence u did not see the widget in many places). For 2.2 we took a slightly different approach: The country field is a simple html select box (the values are restricted by the countries configured in the admin area). The state selector is now dynamic and refreshed with new values whenever the country is changed. We took inspiration and borrowed a fair part of the code from: Simple chained combobox plugin for jQuery.
This model is much easier to replicate and we've introduced it in a more places including profiles, contribution pages and event registration pages. It was kinda nice to see the number of lines of js code being deleted with this new scheme. We felt quite bad that we did not think of doing it this way to begin with, but you learn as you grow :)
Extending the "amounts" field in transaction pages
One request that we hear quite often is: How do we make prices for an event dynamic, so our members get a 10% discount (or $10 off). Trying to add this logic via the UI did not seem easy since different folks had different requirements. We also wanted to make similar changes to the contribution pages, so an org could tailor the amounts displayed to a logged in user based on their past giving history (i.e. increase the donation amounts displayed if the donor has given significant amounts in the recent past).
We've been incorporating hooks into many places in CiviCRM, and this seemed another good place to use hooks. Deepak and I spent an afternoon reworking the code to facilitate this along with a sample hook implementation. The good news was the code was in pretty good shape that we wrapped the project up quite quickly. We standardized on the amount structure across contributions and events. An example hook implementation which gives a discount to all Student members is as follows:
function civitest_civicrm_buildAmount( $pageType,
&$form,
&$amount ) {
// lets add an arbitrary amount here, just to show folks
// the power of a hook :)
$amount[1000] = array( 'value' => 400,
'label' => 'Hook',
'amount_id' => 1000 );
// now lets get a bit more ambitious
// *GOAL*: lets plan to give 20% discount to students
$membershipType = 'Student';
$discountPercent = 20;
// get the membership-type-id for the membership-type
$membershipTypeId = CRM_Core_DAO::getFieldValue( 'CRM_Member_DAO_MembershipType',
$membershipType,
'id',
'name' );
// get the logged in user id
$session =& CRM_Core_Session::singleton();
$userID = $session->get( 'userID' );
if ( $userID ) {
// check if logged in user has 'Student' membership
require_once 'CRM/Member/BAO/Membership.php';
$membership = CRM_Member_BAO_Membership::getContactMembership( $userID, $membershipTypeId, null );
// If logged in contact is a member as on today, modify the amount
// to reflect the discount.
if ( CRM_Utils_Array::value( 'is_current_member', $membership ) ) {
foreach ( $amount as $amountId => $amountInfo ) {
$amount[$amountId]['value'] = $amount[$amountId]['value'] -
ceil($amount[$amountId]['value'] * $discountPercent / 100);
$amount[$amountId]['label'] = $amount[$amountId]['label'] .
"\t - with {$discountPercent}% discount (for $membershipType)";
}
}
}
}







Comments
can $membershipType be an array?
we'd like to extend a discount to multiple membership types