TransWikia.com

How do i get the contribution table entries?

CiviCRM Asked by safron on August 30, 2021

I want to get all the contribution table entries as a list which are equivalent to a given ID.

My contribution table has 4 entries and the contact ID for all the four contribution is 2.

I’m using the below method to get the details, but which takes the given ID as contactID and return the entries when contactID = contributionID..

foreach ($values as $key => $value){
        
        $contributionID = $values[$key]; //contribution IDs are 1,2,3,4,5
        
        // get the details for all selected contacts
        list($contributionDetails) = CRM_Utils_Token::getTokenDetails(array($contributionID),
          $this->_returnProperties,
          NULL, NULL, FALSE,
          $this->_allTokens
        );

Mean this only returns a row where contribution ID = contact ID = 2..but i want to get all the raw where contribution id is equal to 1,2,3,4 and 5.. how should i get it?

Thanks in advance!

One Answer

You can use CRM_Contribute_BAO_Contribution::getContributionTokenValues() function to get details of contribution based on contribution id.

To get all data of contribution you can use api

$contributionData = civicrm_api3('Contribution', 'getsingle', ['id' => $contributionId]);

Correct answer by Pradeep Nayak on August 30, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP