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 (Moderator: Donald Lobo) »
  • custom search on price set
Pages: [1]

Author Topic: custom search on price set  (Read 1318 times)

heXman

  • I’m new here
  • *
  • Posts: 5
  • Karma: 1
custom search on price set
February 27, 2010, 02:47:05 pm
Hi,

i want to use the custom search : » Price Set Details for Event Participants.
But i found out that it always returns 0 for every price option.

Anybody else has this problem, any hints on how to fix this?

thanks

Kurt

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: custom search on price set
February 27, 2010, 04:06:39 pm

you might want to edit and add debug statements to the file:

CRM/Contact/Form/Search/Custom/PriceSet.php

and figure out whats happening and why. If you do find a bug, please submit a patch to fix it

thanx

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

lcdweb

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1620
  • Karma: 116
    • www.lcdservices.biz
  • CiviCRM version: many versions...
  • CMS version: Joomla/Drupal
  • MySQL version: 5.1+
  • PHP version: 5.2+
Re: custom search on price set
February 27, 2010, 04:42:44 pm
is your installation an upgrade from older versions?
if so, some of the old data in price sets was not completely migrated to the more recent structures -- the upgrade script just didn't accommodate it.

try creating a new price set and put a few sample records in there, and see if it works.
support CiviCRM through 'make it happen' initiatives!
http://civicrm.org/mih

heXman

  • I’m new here
  • *
  • Posts: 5
  • Karma: 1
Re: custom search on price set
February 28, 2010, 12:29:13 am
hi, thanks for the feedback.
I will add debrug statements to see where it goes wrong.
And yes it is an upgrade, but i don't think that's the problem.

last night i also tried it in the demo and in the sandbox, both give 0 as the price results
You can see it here:
http://drupal.demo.civicrm.org/civicrm/contact/search/custom?_qf_Custom_display=true&qfKey=4c965800c72e74fa9e1c0626f624d198

What is the best way to get debug results from the file
CRM/Contact/Form/Search/Custom/PriceSet.php ?

thanx

Kurt

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: custom search on price set
February 28, 2010, 07:20:42 am

you can use any PHP/ drupal / civicrm ( CRM_Core_Error::debug) debugging statement (lots of options there). if you are not familair with php, consider hiring someone who is familiar with PHP

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

heXman

  • I’m new here
  • *
  • Posts: 5
  • Karma: 1
Re: custom search on price set
February 28, 2010, 08:25:00 am
Hi, i've been trying some things today.
I'm a php coder, but not that familiar with civi.
I think the problem lies in updating the temporary table used to combine search results from different tables.
So maybe there's something wrong with the SQL statements. I'm looking into that for the moment. I will try to rewrite part of the SQL statements using INNER JOIN.
The first part seems to work as the participant list is shown in the output, but the part that is used to update the numbers for different price sets returns no results it seems.

I keep working on it, but every hint is welcome.

thanks

Kurt

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: custom search on price set
February 28, 2010, 04:59:29 pm

if u need any help or explanation of that code, please do ask questions on IRC

good to see u making progress on this. thanx a lot :)

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

heXman

  • I’m new here
  • *
  • Posts: 5
  • Karma: 1
Re: custom search on price set
March 01, 2010, 12:54:56 pm
Hi,

for what its worth, i think i found a solution for my problem.
I don't know if this is a good fix, but it works for us.

i did replace the SQL statements around line 114
with this
Code: [Select]
$sql="
SELECT c.contact_id,
       c.participant_id,
       v.id AS option_value_id,
       l.qty
FROM {$this->_tableName} c INNER JOIN civicrm_line_item l,
     civicrm_option_group g,
     civicrm_option_value v
WHERE c.participant_id = l.entity_id
AND   l.option_group_id = g.id
AND   v.option_group_id = g.id
AND   v.label = l.label
ORDER BY c.id, v.id
";
I did remove some things from the original because i don't use contributions or payments.

this is the original code

Code: [Select]
   $sql = "
SELECT c.id as contact_id,
       p.id as participant_id,
       v.id as option_value_id,
       l.qty
FROM   civicrm_contact c,
       civicrm_contribution o,
       civicrm_participant  p,
       civicrm_participant_payment pp,
       civicrm_line_item    l,
       civicrm_option_group g,
       civicrm_option_value v
WHERE  c.id = o.contact_id
AND    c.id = p.contact_id
AND    p.event_id = {$this->_eventID}
AND    pp.contribution_id = o.id
AND    pp.participant_id  = p.id
AND    o.id = l.entity_id
AND    l.option_group_id = g.id
AND    v.option_group_id = g.id
AND    v.label = l.label
ORDER BY c.id, v.id
";

thanx

Kurt

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • custom search on price set

This forum was archived on 2017-11-26.