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 CiviEvent (Moderator: Yashodha Chaku) »
  • How to add custom fields against a price set?
Pages: [1]

Author Topic: How to add custom fields against a price set?  (Read 617 times)

stuart

  • I post occasionally
  • **
  • Posts: 41
  • Karma: 0
  • CiviCRM version: 4.2.7
  • CMS version: Drupal 6
  • MySQL version: 5.0.77
  • PHP version: 5.3
How to add custom fields against a price set?
March 24, 2014, 04:59:09 am
Is there a simple way to add a custom field to each line in a price set?

If there isn't, would it be possible to implement using a combination of standard CiviCRM hooks?

Something like adding a supplementary table to store the custom data, then using a buildForm hook to add the new field to the price set form, and postProcess to save the data. Not very familiar with core Civi development, so don't know if this is feasible.

Failing that, I guess overriding the core files would be the only option.

Thanks.
« Last Edit: March 24, 2014, 05:01:46 am by stuart »

joanne

  • Administrator
  • Ask me questions
  • *****
  • Posts: 852
  • Karma: 83
  • CiviCRM version: 4.4.16
  • CMS version: Drupal 7
Re: How to add custom fields against a price set?
March 24, 2014, 06:19:12 am
It may help others to provide a useful answer if you describe your use case in more detail.

Do you need a different custom field filled in for each option they could select?

If so you may be able to use jQuery to get the appropriate custom field to pop up when an option is selected.

stuart

  • I post occasionally
  • **
  • Posts: 41
  • Karma: 0
  • CiviCRM version: 4.2.7
  • CMS version: Drupal 6
  • MySQL version: 5.0.77
  • PHP version: 5.3
Re: How to add custom fields against a price set?
March 24, 2014, 06:32:40 am
Quote from: joanne on March 24, 2014, 06:19:12 am
It may help others to provide a useful answer if you describe your use case in more detail.

Each time I add a new field to the price set, I'd like there to be a Price Code which needs to be filled in by the administrator. Each field in the price set would have a different value for this Price Code. The end-user registering for events wouldn't need to see or change this field in any way.

I've attached a mockup to try to make it clearer.

Not sure how jQuery could popup an extra window, as I wouldn't have the id of the field in the price set yet to relate my custom field back to.

joanne

  • Administrator
  • Ask me questions
  • *****
  • Posts: 852
  • Karma: 83
  • CiviCRM version: 4.4.16
  • CMS version: Drupal 7
Re: How to add custom fields against a price set?
March 24, 2014, 08:26:53 am
The extra explanation has helped a little.  I thought you were referring to an already created price set as viewed by someone registering for your event, not something that was happening during the creation of the price set. Hence my suggestion of using jQuery.

Personally I still need more detail to understand what you are trying to do.  What use is made of the price code?  Does each field in each price set have a different price code or might the same price code be used in different price sets?

stuart

  • I post occasionally
  • **
  • Posts: 41
  • Karma: 0
  • CiviCRM version: 4.2.7
  • CMS version: Drupal 6
  • MySQL version: 5.0.77
  • PHP version: 5.3
Re: How to add custom fields against a price set?
March 24, 2014, 09:57:47 am
Thanks for your patience.

The price codes relate back to different tax rates held in separate tables - so once this first step is in place I will also need to modify the event checkout process, so that if a customer chooses different bits of the price set, appropriate tax is added on.

Each field could have a different price code (but some will be the same), ideally the value will just be a free text field.
« Last Edit: March 24, 2014, 10:04:00 am by stuart »

joanne

  • Administrator
  • Ask me questions
  • *****
  • Posts: 852
  • Karma: 83
  • CiviCRM version: 4.4.16
  • CMS version: Drupal 7
Re: How to add custom fields against a price set?
March 24, 2014, 04:26:31 pm
Ah, Tax - and perhaps more to the point for me, not tax in Australia where the price you advertise must include the tax component and there is only one tax rate.

I don't think I can help you as it not something I have had to consider.

I do have a suggestion though.  The small number of your posts suggests you are fairly new to this forum, which, in turn, suggests you are fairly new to CiviCRM.

Tax is something that many people will have had to deal with and many people on this forum have years of experience using CiviCRM. Perhaps your first post should have been something like:

"I am running an event where different options attract different tax rates.  My idea is to ...  Does this seems a reasonable thing to do or can someone suggest a better way to deal with it?"

Also, your forum profile says you are running 4.2.7.  Is that up-to-date? (Mine wasn't, I have just updated it to show 4.2.15 instead of 4.2.10)

Are you able to upgrade to 4.4?  I know that in 4.4 you can specify a different financial type for each option in a price set and that may help with your problem.

 



 


stuart

  • I post occasionally
  • **
  • Posts: 41
  • Karma: 0
  • CiviCRM version: 4.2.7
  • CMS version: Drupal 6
  • MySQL version: 5.0.77
  • PHP version: 5.3
Re: How to add custom fields against a price set?
March 25, 2014, 02:42:35 am
I took a look at the price set changes in 4.4, unfortunately that wouldn't meet the requirements I've been given. I know other companies have also put in place custom solutions to deal with the complexities of tax. The new CiviAccounts functionality might meet the requirements, but it's still being worked on.

We have a problematic upgrade cycle as our system has been customized, and patches have to be reapplied and tested to the overriden custom PHP.

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: How to add custom fields against a price set?
March 25, 2014, 11:18:08 am

1. would recommend u upgrade sooner rather than later, will be helpful in the long run

2. You should be able to do the above using the buildForm hook, customized template and postProcess hook

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

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • How to add custom fields against a price set?

This forum was archived on 2017-11-26.