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 Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Custom Requirements
Pages: [1]

Author Topic: Custom Requirements  (Read 745 times)

sachuit

  • I’m new here
  • *
  • Posts: 24
  • Karma: 0
  • CiviCRM version: 3.3.beta2
  • CMS version: Joomla! 1.5.22 Stable
  • MySQL version: 5.0.77
  • PHP version: 5.2.10
Custom Requirements
November 24, 2010, 06:49:55 pm
Hi,

I'm developing a Joomla website that has custom requirements as below; and all the process needs to be done on the front-end by end-user

1) The owner of the website should have members under it. I think this should be done by creating a "contribue" page for signing up for membership.
2) The membership should be different type. e.g. gold, silver, etc.
3) Critical: Member can also have other members and a member has to pay while singing up for total of all members under it. (e.g. if $100 is for gold membership, so for three members: it's $300) Not sure how to create hierarchy here. and as I think it needs to be dynamic, so while singing up can add as many members and eventually pay fees accordingly.
4) Events Registration: need to have different prices;
    1) Gold members
    2) Silver members
    3) for non-members (non-users) can directly register for event.
5) Member can login to site and update their details plus their members' details

I have tried my three days solving these problems with no luck, appreciated if someone can help here.

Thank you.

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Re: Custom Requirements
November 24, 2010, 07:56:18 pm
I think you may be interested in contributing to the work being done on Using Price Sets for Memberships- a search on those terms should spit out the forum or blog. Not sure if that deals with what you want

Sounds like what you are asking is the sort of thing that Events allows by way of signing up several people in one go

Good luck
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

Rajan Mayekar

  • I post frequently
  • ***
  • Posts: 177
  • Karma: 20
    • Rajan's Blogs
Re: Custom Requirements
November 24, 2010, 08:00:33 pm
Hi sachuit,

Quote
The owner of the website should have members under it. I think this should be done by creating a "contribue" page for signing up for membership.
Yes you can make contribution page for membership signup.

Quote
The membership should be different type. e.g. gold, silver, etc.
You can easily add/edit memberships types ( civicrm/admin/member/membershipType&reset=1 ).

#3 not sure what u want exactly but I would like to suggest you to take a look @ priceset ( priceset with field having count )

Quote
Events Registration: need to have different prices;   
This can be done by implementing hook_civicrm_buildAmount.

sachuit

  • I’m new here
  • *
  • Posts: 24
  • Karma: 0
  • CiviCRM version: 3.3.beta2
  • CMS version: Joomla! 1.5.22 Stable
  • MySQL version: 5.0.77
  • PHP version: 5.2.10
Re: Custom Requirements
November 24, 2010, 11:34:16 pm
Thanks for heading up. I am looking in to creating some hooks.

Appriciated.

sachuit

  • I’m new here
  • *
  • Posts: 24
  • Karma: 0
  • CiviCRM version: 3.3.beta2
  • CMS version: Joomla! 1.5.22 Stable
  • MySQL version: 5.0.77
  • PHP version: 5.2.10
Re: Custom Requirements
November 25, 2010, 04:17:02 pm
Hello,

I have been able to differentiate the prices for events using their weight, but fees must be entered in the same weight order as membership weight order. e.g. Membership weight order; gold, silver then the fees for events must be gold, silver, general.

Not sure if it's the correct solution, new ideas are most welcome. Below is code I came up with;

/*
Parameters
    * $pageType - is this a 'contribution' or 'event'
    * $form - reference to the form object
    * $amount - the amount structure to be displayed
*/
function joomla_civicrm_buildAmount( $pageType, &$form, &$amount )
{
   if ($pageType == 'event')
   {
      $session =& CRM_Core_Session::singleton();
      $userID  = $session->get( 'userID' );
      $event_id = $_GET['id'];
      $t = "civicrm_event.amount.".$event_id;
      $event_qry = "SELECT cov.label, cov.value FROM civicrm_option_value cov, civicrm_option_group cog, civicrm_event ce
            WHERE
               cov.option_group_id = cog.id AND
               cog.name = '{$t}' AND
               ce.id = $event_id";
      $event_res = mysql_query($event_qry);

      require_once 'CRM/Member/BAO/Membership.php';
      $ft_allMembershipTypes = getMembershipTypes();
      
      if ( $userID ) {
         $membership = CRM_Member_BAO_Membership::getContactMembership( $userID, null, null );
         if ( CRM_Utils_Array::value( 'is_current_member', $membership ) )
         {
            foreach ($ft_allMembershipTypes as $index => $ft_allMember)
            {
               if ($ft_allMember['id'] == $membership['membership_type_id'])
               {
                  foreach ($amount as $amountId => $amountInfo)
                  {
                     if ($ft_allMember['id'] != $amountInfo['weight'])
                     {
                        unset($amount[$amountId]);
                     }
                     else
                     {
                        $form->_values['event']['default_fee_id'] = $amountInfo['amount_id'];
                        $amount[$amountId]['label'] = "";
                        //foreach ($ft_allMembershipTypes as $index => $ft_allMember)
                        while ($row = mysql_fetch_array($event_res))
                        {
                           $amount[$amountId]['label'] .= "<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * $ {$row['value']} for {$row['label']}";
                        }
                     }
                  }
               }
            }
         }
      }
      else
      {
         foreach ( $amount as $amountId => $amountInfo ) {
            if ($amountInfo['weight'] == 3)
            {
               $amount[$amountId]['label'] = "";
               //foreach ($ft_allMembershipTypes as $index => $ft_allMember)
               while ($row = mysql_fetch_array($event_res))
               {
                  $amount[$amountId]['label'] .= "<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * $ {$row['value']} for {$row['label']}";
               }
            }
            else
               unset($amount[$amountId]);
         }
      }
   }
}

function getMembershipTypes($public = true)
{
   $membershipTypes = array();
   $membershipType = & new CRM_Member_DAO_MembershipType( );
   $membershipType->is_active = 1;
   if (  $public ) {
      $membershipType->visibility = 'Public';
   }
   $membershipType->find();
   $c = 0;
   while ( $membershipType->fetch() ) {
      $membershipTypes[$c]['id'] = $membershipType->id;
      $membershipTypes[$c]['name'] = $membershipType->name;
      $c++;
   }
   return $membershipTypes;
}

Thank you all.

sachuit

  • I’m new here
  • *
  • Posts: 24
  • Karma: 0
  • CiviCRM version: 3.3.beta2
  • CMS version: Joomla! 1.5.22 Stable
  • MySQL version: 5.0.77
  • PHP version: 5.2.10
Re: Custom Requirements
November 27, 2010, 05:07:01 pm
Hi,

Can anyone tell me how I can get the "contact id" (Civicrm Id) of currently logged in user?

Actually, I need a hook to create relationship between 2 individuals when logged in user create a new individual, not sure how to create hook for this??!

Also, if someone know about recurring payment on sign up? I want the user to sign up and pay every month automatically.

Thanks for all your help.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Custom Requirements

This forum was archived on 2017-11-26.