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

Add method to retrieve price fields via ContributionPage.get API

    Details

    • Type: Bug
    • Status: Open
    • Priority: Trivial
    • Resolution: Unresolved
    • Affects Version/s: 4.7.18
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Versioning Impact:
      Patch (backwards-compatible bug fixes)
    • Documentation Required?:
      Developer Doc
    • Funding Source:
      Contributed Code
    • Verified?:
      No

      Description

      Possibly just needs documenting, I don't see it.

      If I use ContributionPage.get to retrieve a Contribution Page (or Event, etc), there doesn't seem to be a method in the API to directly retrieve the priceset(s) associated with that page.

      In API explorer for PriceSet entity, we can select "Extends" and select a Civi entity type (eg contribution page), but not a specific entity.

      There's an internal method but not an exposed API method?

      CRM_Price_BAO_PriceSet::getFor('civicrm_contribution_page', $id));
      
      # Returns contribution page data but not info about pricesets associated with
      cv api ContributionPage.get
      # Returns pricesets, but not clear how to filter to desired contribution page
      cv api PriceSet.get sequential=1 extends="CiviContribute"
      

      You can post-filter the priceset results, but this seems like something the API would offer.

      I've implemented for my own needs here, keen to find either if there's already a way to do this (yay) or if not whether we should add to API.

      https://github.com/fuzionnz/contrib.entityextra/blob/master/CRM/Entityextra/APIWrapper.php#L11

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              xurizaemon Chris Burgess
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: