I was trying to display event info using views (to replace the current event info) and realized that the fee is not present. I believe it used to be avail in standard views but can't seem to find. I see Fee label and Default Fee ID fields. I assume they are an index into other tables (Price sets?) Any suggestions on how to display?

Comments

sonicthoughts’s picture

I just saw this patch avail for views to add additional entities. Wonder if we could/should include for Civicrm Entity module?

New Feature Request:
Integrate price sets and price field data with Drupal Views.

Use Case:
Need to create event listings in Drupal using Views and that include information stored in price sets, such as registration fees and workshops.

Patch Info:
The attached patch adds a Price Set ID field to CiviCRM Events in Views.
In addition, it enables Views to be created on:
- CiviCRM Price Sets
- CiviCRM Price Fields
- CiviCRM Price Field Values
It includes a Views Relationship between CiviCRM Price Fields and CiviCRM Price Field Values to make it easier to retrieve all of the values for a price field.

Usage:
Typical usage would be to create a view on CiviCRM Price Set or CiviCRM Price Field and pass in a Price Set ID as a contextual filter. The Price Set ID can be obtained as a field on CiviCRM Events. A Views Relationship can be added between CiviCRM Price Fields and CiviCRM Price Field Values to retrieve all of the values for a price field.

eileenmcnaughton’s picture

that patch will go in core - but no reason we can't enable those entities as CiviCRM entities - do you want to try & see what happens

You just need to add the extra entities in 2 places

https://github.com/eileenmcnaughton/civicrm_entity/blob/7.x-2.x/civicrm_...
https://github.com/eileenmcnaughton/civicrm_entity/blob/7.x-2.x/civicrm_...

& if you try that & say those entities should be enabled I'm happy to accept that as a patch / PR (or I can apply it if you aren't sure how to submit that way).

Note that we won't implement the relationship that way in civicrm entities - if we are going to implement more relationship we'll figure out a more generic way to do it

markusa’s picture

I did test PriceSets, PriceFields, and PriceFieldValues with civicrm entity 2.x and it works...at least as far as my limited testing went...

sonicthoughts’s picture

I tried to add the three bundles in both places, cleared cache, but I do not see any fields. I do see the entity, but no fields are listed. I also do not see in views. No error in watchdog. I assume the CamleCase was not a problem (perhaps not consistent.)

function _civicrm_entity_labels($entity) {
  $labels = array(
    'civicrm_activity' => 'subject',
    'civicrm_address' => 'address_name',
    'civicrm_contact' => 'display_name',
    'civicrm_contribution' => 'source',
    'civicrm_email' => 'email',
    'civicrm_event' => 'title',
    'civicrm_participant' => 'source',
    'civicrm_relationship' => 'description',
    'civicrm_relationship_type' => 'description',
    // OK, I'm just putting in something that won't error for now.
    'civicrm_entity_tag' => 'tag_id',
    'civicrm_financial_type' => 'description',
    // Ditto.
    'civicrm_membership' => 'id',
    'civicrm_membership_type' => 'name',
    'civicrm_group' => 'name',
    'civicrm_grant' => 'id',
    'civicrm_tag' => 'name',
      'civicrm_PriceSets' => 'PriceSets',
      'civicrm_PriceFields' => 'PriceFields',
      'civicrm_PriceFieldValues' => 'PriceFieldValues',
  );
function _civicrm_entity_enabled_entities() {
  $whitelist = array(
    'civicrm_activity' => 'activity',
    'civicrm_address' => 'address',
    'civicrm_email' => 'email',
    'civicrm_event' => 'event',
    'civicrm_contact' => 'contact',
    'civicrm_contribution' => 'contribution',
    'civicrm_participant' => 'participant',
    'civicrm_relationship' => 'relationship',
    'civicrm_relationship_type' => 'relationship_type',
    'civicrm_entity_tag' => 'entity_tag',
    'civicrm_membership' => 'membership',
    'civicrm_membership_type' => 'membership_type',
    'civicrm_group' => 'group',
    'civicrm_grant' => 'grant',
    'civicrm_tag' => 'tag',
      'civicrm_PriceSets' => 'PriceSets',
      'civicrm_PriceFields' => 'PriceFields',
      'civicrm_PriceFieldValues' => 'PriceFieldValues',
  );
markusa’s picture

function _civicrm_entity_labels($entity) {
  $labels = array(
    'civicrm_activity' => 'subject',
    'civicrm_address' => 'address_name',
    'civicrm_contact' => 'display_name',
    'civicrm_contribution' => 'source',
    'civicrm_email' => 'email',
    'civicrm_event' => 'title',
    'civicrm_participant' => 'source',
    'civicrm_relationship' => 'description',
    'civicrm_relationship_type' => 'description',
    // OK, I'm just putting in something that won't error for now.
    'civicrm_entity_tag' => 'tag_id',
    'civicrm_financial_type' => 'description',
    // Ditto.
    'civicrm_membership' => 'id',
    'civicrm_membership_type' => 'name',
    'civicrm_group' => 'name',
    'civicrm_grant' => 'id',
    'civicrm_tag' => 'name',
    'civicrm_price_set' => 'id',
    'civicrm_price_field' => 'id',
    'civicrm_price_field_value' => 'id',
  );
function _civicrm_entity_enabled_entities() {
  $whitelist = array(
    'civicrm_activity' => 'activity',
    'civicrm_address' => 'address',
    'civicrm_email' => 'email',
    'civicrm_event' => 'event',
    'civicrm_contact' => 'contact',
    'civicrm_contribution' => 'contribution',
    'civicrm_participant' => 'participant',
    'civicrm_relationship' => 'relationship',
    'civicrm_relationship_type' => 'relationship_type',
    'civicrm_entity_tag' => 'entity_tag',
    'civicrm_membership' => 'membership',
    'civicrm_membership_type' => 'membership_type',
    'civicrm_group' => 'group',
    'civicrm_grant' => 'grant',
    'civicrm_tag' => 'tag',
    'civicrm_price_set' => 'price_set',
    'civicrm_price_field' => 'price_field',
    'civicrm_price_field_value' => 'price_field_value',
    
  );
sonicthoughts’s picture

Ok, still some strange stuff going on (probably my error ...) Views does show the Entity/fields, but admin menu and entity display are "stuck" with the old values.
1. I changed the file as referenced above (duhh)
2. drush cc all
3. Tried to access priceset via direct entity edit form (ie. /civicrm-price_set/2 OR /admin/structure/types/manage/civicrm_price_set/display - page not found.
4. I tried drush rr (registry rebuild)
5. now the strange thing is that the old code: admin/structure/types/manage/civicrm_PriceSets still works (no fields though.) even though I changed the code as per above! I also see in admin menu|content types|Civicrm PriceSets

Could it be that the old whitelist is not being removed / cleaned up. I also tried to disable/re-enable the module (didn't try to remove it yet.)

Also (and more importantly), how do i make the relationship between event and price_set? Should this be done in the module (http://drupal.stackexchange.com/questions/64875/how-to-add-relationship-...) or using the Entity Reference Module ?

My goals is simply to include the fees for an event.

notes:

I tried to use both the github 2.x nov 29th and drupal 2.x dec2nd (are they the same?)
I also see a patch included in the distro: "full-working-crud-forms-drupal-fields-standard.patch" - is that meant to be run?
Thanks for your patience with me ...

markusa’s picture

The patch file in the repo was probably just placed there as a diff to know what was changed...No need to run or apply that.

try: civicrm-price-set/1 , I've been replacing _ with - for the urls

I'm able to access Manage Display, and Manage fields for Price sets, without any additional effort...

As far as the views relationships go...that would have to be coded, and placed in an auxilary module.

I've been playing with it a little bit, but haven't gotten it to work yet....

There's two tables price_set and price_set_entity, and I haven't had success loading them both as entities, the code above inlcudes the data from the price_set table, not price_set_entity....but that is where the connection is made to events or contribution pages...

markusa’s picture

I don't think this is going into the CiviCRM Entities module...unless Eileen wants it...

Cobbled together a little module to get views relationships:

https://github.com/jackrabbithanna/civicrm_price_field_aux

So with a view that lists events:

Add new relationships to drill down to the Price Field Values:
CiviCRM Price Set Entities: Price Set
(Price Set) Price Field: Price Field
(Price Field) CiviCRM Price_field: Price Field Value

markusa’s picture

@sonicthoughts:

I forgot, the code also needed some additions to include permissions for viewing/editing/deleteing price sets, price fields, and price field values...

You won't be able to get to those pages without that....

@eileen:

I've created a PR to include Price Sets, Price Fields, and Price field values, if you want that in the project...

@sonicthoughts:
working code for price entities here for now: https://github.com/jackrabbithanna/civicrm_entity
that will work with this: https://github.com/jackrabbithanna/civicrm_price_field_aux

eileenmcnaughton’s picture

I've merged the price set patch - re the joins patch - thoughts.

1) does it interact OK with the patched version of views that sonicthoughts referred to?
2) the join to event doesn't take into account the entity_table field
3) you seem to be declaring some things (field sortability etc) that ideally we could do more generically
4) join to civicrm_contribution changes between 4.4 & 4.5 (you aren't doing that join)

I'm inclined to leave it separate for now & see what things we can do in a generic way (e.g declare joins whereever we hit an FK or based on the pseudoconstants in the schema

markusa’s picture

I agree about the views, I put it into a separate module for that reason. I just put it up so sonicthoughts could get the functionality he wants right now. CiviCRM Entity should do its best to do things systematically, without specific views coding...

RE: the patch mentioned, for people running CiviCRM with that patch, (I assume its coming for 4.6) it would be unnecessary. If they are running an earlier version, well then people can use the little module...I don't think you'd want to do both at the same time.

The join doesn't take into account the entity_table, but it doesn't matter. That would only apply to Views that are lists of events anyway...it joins the id with the entity_id field, so for events, the price set data for that event will be available.

If we exposed contribution_pages, we could do some similar code for them....

sonicthoughts’s picture

Hi guys - been doing some more testing (on 7.x-2.x-dev 12/7 release).

1. civicrm-price-set/1
generally works, but for some fields get: Warning: htmlspecialchars() expects parameter 1 to be string, array given in check_plain() (line 1583 of /home/xxxx/public_html/test/includes/bootstrap.inc).

function drupal_validate_utf8($text) {
  if (strlen($text) == 0) {
    return TRUE;
  }
  // With the PCRE_UTF8 modifier 'u', preg_match() fails silently on strings
  // containing invalid UTF-8 byte sequences. It does not reject character
  // codes above U+10FFFF (represented by 4 or more octets), though.
  return (preg_match('/^./us', $text) == 1);
}

2. Missing template files. Would it be possible to use a generic method for tpl files so we can add new entities w/out a patch? Get:

Warning: include(/home/xxxxx/public_html/test/sites/all/modules/civicrm_entity/templates/civicrm-price-field-value.tpl.php): failed to open stream: No such file or directory in theme_render_template() (line 1525 of /home/xxxxx/public_html/test/includes/theme.inc).
Warning: include(): Failed opening '/home/xxxxx/public_html/test/sites/all/modules/civicrm_entity/templates/civicrm-price-field-value.tpl.php' for inclusion

3.Recipie for exposing price fields (Mark, got a bit stuck showing multiple field values in price set.):
a. Install and enable the module: civicrm_price_field_aux
b. Add price template files if necessary (ie. copy modules/civicrm_entity/templates/civicrm-tag.tpl.php to civicrm-price-set.tpl.php php civicrm-price-field-value.tpl.php civicrm-price-field.tpl.php)
c. Add 2 new fields: CiviCRM Price Set Entities: Entity Table (Entity Table) and CiviCRM Price Set Entities: Price Set ID (Price Set ID)
d. Add relationships :first, CiviCRM Price Set Entities: Price Set, then (Price Set) Price Field: Price Field, then (Price Field) CiviCRM Price_field: Price Field Value
e. Add new related value fields (e.g. CiviCRM Price_field_value: Amount (Amount), (Price Field Value) price-field-val label (Label), etc.

I'm not sure why all the field values are not showing up - I have a few for each event.

note - got strange error: SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'help_post' in field list is ambiguous (also for other fields) unless I changed the administrative name - Guess some naming conflict.

So much for trying to do something simple :)
I think that showing linked event info is very important for anyone trying to use Drupal as a front end, but wonder if there is a way to get the whole thing rendered right from civicrm (like a location block) as a shortcut....
Also, is the module you created necessary or can it (should it) be accomplished with Entity Reference Fields? Frankly, the whole multi-level indirection is making my head spin a bit. Your a real rock star for helping out with this!

markusa’s picture

I forgot to add the template files in the the PR... :(

The little module I create was necessary to get the relationships so that you could show price_field_value data for events....One thing I noticed was that the event data would get listed for each price field value, so some usage of the Views Field View module might be appropriate.

Its the same as if you had nodes with a multi-valued term reference field, and you add a relationship to term data, if you have 2 term referenced on a node, the view will list the node twice.....

So when you say:

I'm not sure why all the field values are not showing up - I have a few for each event.

does that mean that some show up and some don't? I've done limited testing, enough to get a basic event pricing to work, didn't even try yet with more complicated price set pricing structures.

So much for trying to do something simple :)

Well nothing worth doing is easy the first time :) Gotta crawl before we walk and what not.

I havent' experienced the SQL error you mentioned, but I've seen the:

Warning: htmlspecialchars() expects parameter 1 to be string, array given in check_plain() (line 1583 of /home/xxxx/public_html/test/includes/bootstrap.inc).

for several entities, not just price set fields...

Can you provide details on what field values are not displaying? Types of fields, configuration, etc...

Shoot me an email or ping me on Google and we can schedule a short screen share so that I can look it over....

sonicthoughts’s picture

Old issue, but I just upgraded from 4.5.x to 4.6.2 and noticed that the Amount field in the PriceFieldValue entity is now including the currency symbol ($) however I'm trying to use a different currency. (It's actually a pain because the currency field is with the event not the priceset/pricefield.

Any idea why the $ is hard coded here? Could it know that it is a currency field and need drupal views to set it somehow???

markusa’s picture

Status: Active » Closed (fixed)

closing this issue....start a new issue with the latest comment if it still occurs

tstermitz’s picture

I was able to get an Event Price to show up in an event views using Views Field View and contextual links using the Price Set ID. I followed this tutorial: https://www.ostraining.com/blog/drupal/views-field-view/ . You have to create your sub-view off "Price Fields", not Price Sets", although both of them have the Price Set ID in them.

I have a feeling this is not an efficient mechanism.

I don't understand why CiviCRM can't create a relationship between Event and Price Field entities?

markusa’s picture

did you try this module:
https://github.com/jackrabbithanna/civicrm_price_field_aux

That should provide you the necessary relationships

Katy Jockelson’s picture

I know this is an old thread, but it's the only one I can find on this subject.
I am trying to set up a view to replace the individual event info page and I've got it working with a contextual filter in the URL, to show all fields except the priceset. I have tried markusa's module (gives me a broken handler when I try to add relationship). I'm just starting down the road of a view within a view as per the last comment here but I'm getting a bit lost, and before I go any further, I just wanted to check if it should be possible to add an event priceset to a view, without needing a secondary view. If yes, instructions would be really really helpful. Thank you!

Also noticed that when I add a relationship of 'CiviCRM Price Set Entities: Price Set' to the view and print the name (or, in fact, just print the priceset ID without the need for the relationship, unless I'm misunderstanding something here, then it's actually returning the wrong ID/priceset. I.e. not the one I've chosen for the event.

markusa’s picture

For sure. Have the latest version of CiviCRM Entity (for Drupal 7)

Install both CiviCRM Entity and the submodule, CiviCRM Entity Views Extras

Here's the export code for a sample View, which is a list of events, but relates to the Price Set, then the Price Fields of the price set, and then the Price Field Values for the Price fields

$view = new view();
$view->name = 'event_view_with_price_set_info_example';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'civicrm_event';
$view->human_name = 'Event View with price set info example';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['title'] = 'Event View with price set info example';
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['access']['type'] = 'none';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['pager']['options']['items_per_page'] = '10';
$handler->display->display_options['style_plugin'] = 'table';
/* Relationship: CiviCRM Price Set Entities: Price Set */
$handler->display->display_options['relationships']['price_set']['id'] = 'price_set';
$handler->display->display_options['relationships']['price_set']['table'] = 'civicrm_price_set_entity';
$handler->display->display_options['relationships']['price_set']['field'] = 'price_set';
/* Relationship: Price Field: Price Field */
$handler->display->display_options['relationships']['civicrm_price_field']['id'] = 'civicrm_price_field';
$handler->display->display_options['relationships']['civicrm_price_field']['table'] = 'civicrm_price_set';
$handler->display->display_options['relationships']['civicrm_price_field']['field'] = 'civicrm_price_field';
$handler->display->display_options['relationships']['civicrm_price_field']['relationship'] = 'price_set';
/* Relationship: CiviCRM Price Fields: Price Field Value */
$handler->display->display_options['relationships']['civicrm_price_field_value']['id'] = 'civicrm_price_field_value';
$handler->display->display_options['relationships']['civicrm_price_field_value']['table'] = 'civicrm_price_field';
$handler->display->display_options['relationships']['civicrm_price_field_value']['field'] = 'civicrm_price_field_value';
$handler->display->display_options['relationships']['civicrm_price_field_value']['relationship'] = 'civicrm_price_field';
/* Field: CiviCRM Events: Event ID */
$handler->display->display_options['fields']['id']['id'] = 'id';
$handler->display->display_options['fields']['id']['table'] = 'civicrm_event';
$handler->display->display_options['fields']['id']['field'] = 'id';
/* Field: CiviCRM Price Sets: Price Set ID */
$handler->display->display_options['fields']['id_1']['id'] = 'id_1';
$handler->display->display_options['fields']['id_1']['table'] = 'civicrm_price_set';
$handler->display->display_options['fields']['id_1']['field'] = 'id';
$handler->display->display_options['fields']['id_1']['relationship'] = 'price_set';
$handler->display->display_options['fields']['id_1']['separator'] = '';
/* Field: CiviCRM Price Fields: Label */
$handler->display->display_options['fields']['label']['id'] = 'label';
$handler->display->display_options['fields']['label']['table'] = 'civicrm_price_field';
$handler->display->display_options['fields']['label']['field'] = 'label';
$handler->display->display_options['fields']['label']['relationship'] = 'civicrm_price_field';
$handler->display->display_options['fields']['label']['label'] = 'Price Field Label';
/* Field: CiviCRM Price Fields: Price Field ID */
$handler->display->display_options['fields']['id_2']['id'] = 'id_2';
$handler->display->display_options['fields']['id_2']['table'] = 'civicrm_price_field';
$handler->display->display_options['fields']['id_2']['field'] = 'id';
$handler->display->display_options['fields']['id_2']['relationship'] = 'civicrm_price_field';
$handler->display->display_options['fields']['id_2']['separator'] = '';
/* Field: CiviCRM Price Field Values: Price Field Value ID */
$handler->display->display_options['fields']['id_3']['id'] = 'id_3';
$handler->display->display_options['fields']['id_3']['table'] = 'civicrm_price_field_value';
$handler->display->display_options['fields']['id_3']['field'] = 'id';
$handler->display->display_options['fields']['id_3']['relationship'] = 'civicrm_price_field_value';
$handler->display->display_options['fields']['id_3']['separator'] = '';
/* Field: CiviCRM Price Field Values: Label */
$handler->display->display_options['fields']['label_1']['id'] = 'label_1';
$handler->display->display_options['fields']['label_1']['table'] = 'civicrm_price_field_value';
$handler->display->display_options['fields']['label_1']['field'] = 'label';
$handler->display->display_options['fields']['label_1']['relationship'] = 'civicrm_price_field_value';
$handler->display->display_options['fields']['label_1']['label'] = 'Price Field Value Label';
/* Field: CiviCRM Price Field Values: Amount */
$handler->display->display_options['fields']['amount']['id'] = 'amount';
$handler->display->display_options['fields']['amount']['table'] = 'civicrm_price_field_value';
$handler->display->display_options['fields']['amount']['field'] = 'amount';
$handler->display->display_options['fields']['amount']['relationship'] = 'civicrm_price_field_value';
$handler->display->display_options['fields']['amount']['label'] = 'Price Field Value Amount';

/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page');
$handler->display->display_options['path'] = 'event-view-with-price-set-info-example';
Katy Jockelson’s picture

Thank you so much. I've just seen this.
I am also trying to just print regular event fees and not seeing how to do that. Any advice on that?
Thanks a lot.

markusa’s picture

Even if you don't select a price set when creating an event, and just use "normal" or "regular" event fees, Civi still creates a price set with one price field, although it is hidden from the CiviCRM Price Set UI.

So you should be able to pull the prices from the price field values of the price field of the price set.

The "Fee label" that is required above the "Financial Type" field, populates the Price Field Label

The Fee Labels in the "Regular Fees" section match up to Price Field Value Label, and the Amounts match up to Price Field Value Amount

The Event title will be the Price Set Title

The View import code I posted would let you see these .. so same structure whether you use a custom price set or not.

Katy Jockelson’s picture

Thank you @markusa. I will try this later and feedback.

Katy Jockelson’s picture

Thanks for your help so far @markusa. I got the fee amounts and labels showing up. In case it's useful to others, I will write out the 2 other issues I encountered.

  1. I had 3 amounts showing up - the 2 I expected to see, that are configured on the event, and then one more, that I worked out was coming from a donation page that happened to have the same ID in the URL. And because I am using the raw value in the URL as the contextual filter, with no option to validate, it was pulling through this other price from a donation page. I fixed this by adding a filter to the view of '(Price Set) CiviCRM Price Sets: Financial Type (= X)' where X is 'Event fee'
  2. I needed my view to work with a contextual filter, so I have it set to show 1 item, based on the URL. But that limits the fee amounts/labels coming through to 1. So in the end, I created a second display within the view (a block) that printed all the price amounts/labels and then used a view field in my first view, with a contextual filter of the event ID, to pull through the prices. That way I could limit view #1 to 1 item, and allow the block display to show all items. Hope that makes sense!
Katy Jockelson’s picture

EDIT: this comment no longer makes sense, as I've edited my comment (#23) above.
Ah, the reason that random price set entry #3 is showing up is because of my contextual filter being based on the raw value in the URL. It's adding in the price set for the contribution page that has the same ID as this event. So that's a whole side issue...

markusa’s picture

For #24 you need to add a filter:
CiviCRM Price Set Entities: Entity Table (= civicrm_event)

So you want to show only 1 Views row, but list multiple fee options?

Couldn't you have a contextual filter of the event id, and limit it to show only price field values for that event .. so in your case two Views rows?

You could definitely theme/style this however you wanted using standard Drupal theme preprocess and templates for the View's format or rows.

Have you tried a format of "Unformatted List" playing with the html wrappers of the fields? You can set them to have no wrappers, or and you could probably get them to go inline.
Here's an example removing much of the

wrappers. It only has
for the rows. To get rid of these, you'd need to have a custom theme template for the rows of this View

Try importing this example, it has a contextual filter too, the event id

$view = new view();
$view->name = 'event_view_with_price_set_info_example';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'civicrm_event';
$view->human_name = 'Event View with price set info example';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['title'] = 'Event View with price set info example';
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['access']['type'] = 'none';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'none';
$handler->display->display_options['pager']['options']['offset'] = '0';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['style_options']['default_row_class'] = FALSE;
$handler->display->display_options['style_options']['row_class_special'] = FALSE;
$handler->display->display_options['row_plugin'] = 'fields';
$handler->display->display_options['row_options']['default_field_elements'] = FALSE;
/* Relationship: CiviCRM Price Set Entities: Price Set */
$handler->display->display_options['relationships']['price_set']['id'] = 'price_set';
$handler->display->display_options['relationships']['price_set']['table'] = 'civicrm_price_set_entity';
$handler->display->display_options['relationships']['price_set']['field'] = 'price_set';
/* Relationship: Price Field: Price Field */
$handler->display->display_options['relationships']['civicrm_price_field']['id'] = 'civicrm_price_field';
$handler->display->display_options['relationships']['civicrm_price_field']['table'] = 'civicrm_price_set';
$handler->display->display_options['relationships']['civicrm_price_field']['field'] = 'civicrm_price_field';
$handler->display->display_options['relationships']['civicrm_price_field']['relationship'] = 'price_set';
/* Relationship: CiviCRM Price Fields: Price Field Value */
$handler->display->display_options['relationships']['civicrm_price_field_value']['id'] = 'civicrm_price_field_value';
$handler->display->display_options['relationships']['civicrm_price_field_value']['table'] = 'civicrm_price_field';
$handler->display->display_options['relationships']['civicrm_price_field_value']['field'] = 'civicrm_price_field_value';
$handler->display->display_options['relationships']['civicrm_price_field_value']['relationship'] = 'civicrm_price_field';
/* Field: CiviCRM Price Field Values: Label */
$handler->display->display_options['fields']['label_1']['id'] = 'label_1';
$handler->display->display_options['fields']['label_1']['table'] = 'civicrm_price_field_value';
$handler->display->display_options['fields']['label_1']['field'] = 'label';
$handler->display->display_options['fields']['label_1']['relationship'] = 'civicrm_price_field_value';
$handler->display->display_options['fields']['label_1']['label'] = '';
$handler->display->display_options['fields']['label_1']['element_type'] = 'strong';
$handler->display->display_options['fields']['label_1']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['label_1']['element_wrapper_type'] = 'span';
$handler->display->display_options['fields']['label_1']['element_default_classes'] = FALSE;
/* Field: CiviCRM Price Field Values: Amount */
$handler->display->display_options['fields']['amount']['id'] = 'amount';
$handler->display->display_options['fields']['amount']['table'] = 'civicrm_price_field_value';
$handler->display->display_options['fields']['amount']['field'] = 'amount';
$handler->display->display_options['fields']['amount']['relationship'] = 'civicrm_price_field_value';
$handler->display->display_options['fields']['amount']['label'] = '';
$handler->display->display_options['fields']['amount']['element_type'] = '0';
$handler->display->display_options['fields']['amount']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['amount']['element_wrapper_type'] = 'span';
$handler->display->display_options['fields']['amount']['element_default_classes'] = FALSE;
/* Contextual filter: CiviCRM Events: Event ID */
$handler->display->display_options['arguments']['id']['id'] = 'id';
$handler->display->display_options['arguments']['id']['table'] = 'civicrm_event';
$handler->display->display_options['arguments']['id']['field'] = 'id';
$handler->display->display_options['arguments']['id']['default_action'] = 'empty';
$handler->display->display_options['arguments']['id']['default_argument_type'] = 'fixed';
$handler->display->display_options['arguments']['id']['summary']['number_of_records'] = '0';
$handler->display->display_options['arguments']['id']['summary']['format'] = 'default_summary';
$handler->display->display_options['arguments']['id']['summary_options']['items_per_page'] = '25';
/* Filter criterion: CiviCRM Price Set Entities: Entity Table */
$handler->display->display_options['filters']['entity_table']['id'] = 'entity_table';
$handler->display->display_options['filters']['entity_table']['table'] = 'civicrm_price_set_entity';
$handler->display->display_options['filters']['entity_table']['field'] = 'entity_table';
$handler->display->display_options['filters']['entity_table']['value'] = 'civicrm_event';

/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page');
$handler->display->display_options['path'] = 'event-view-with-price-set-info-example';


If that doesn't get close to what you need...

The fee amounts are multiple rows in the database, using Views to fetch event price options, will return multiple rows

You could use a View within a View. Your one row in your main View would contain another View with 2 rows.

Katy Jockelson’s picture

Thanks so much. I just finished editing my previous comment with an update on where I'd got to. So now our thread is a little confused!
I found a different filter that worked, and as you'll see - I ended up with my referenced view within a view.

Katy Jockelson’s picture

I'm coming back to this thread in the hope you can help.
I have a view, happily pulling through the event fees via another view. But it's not pulling through the early-bird fee. For an event where there is one regular fee and one early-bird, it's just printing the regular one twice. Any ideas? Thank you.