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) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Advice on getting the price of an event
Pages: [1]

Author Topic: Advice on getting the price of an event  (Read 1616 times)

geilhufe

  • I post frequently
  • ***
  • Posts: 293
  • Karma: 33
    • Social Source Software
Advice on getting the price of an event
September 27, 2009, 08:44:19 pm
Warning: not a coder, I just modify sample code, run it, and when it breaks, scratch my head.

I want to see if anyone can point me in the right general direction and/or if there is any sample code around that would do this.

Problem:
I want to get the price of an event.

I know where I want to start: civicrm_event _id
I know where I want to end: the default price for that event (ignoring any complex price situations): civicrm_contribution_page default_amount_id

It doesn't look like I can get this from the API... it needs to been done in SQL. Correct?
Drupal and CiviCRM consulting, strategy and configuration
http://www.social-source.com/

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Advice on getting the price of an event
September 28, 2009, 07:59:42 am

Code: [Select]
select v.value, v.is_default from civicrm_option_value v, civicrm_option_group g where v.option_group_id = g.id and g.name = 'civicrm_event.amount.1' order by v.is_default;

the option group name is always civicrm_event.amount.EVENT_ID

Note that amounts need not have a default value, hence i put it in the order by clause

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

geilhufe

  • I post frequently
  • ***
  • Posts: 293
  • Karma: 33
    • Social Source Software
Re: Advice on getting the price of an event
September 28, 2009, 09:44:28 am
Thanks much. Will try to remember to post working code when the developer gets it actually functioning.
Drupal and CiviCRM consulting, strategy and configuration
http://www.social-source.com/

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Advice on getting the price of an event

This forum was archived on 2017-11-26.