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) »
  • Smarty fields
Pages: [1]

Author Topic: Smarty fields  (Read 2358 times)

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Smarty fields
April 20, 2009, 04:12:55 am
I want to add a unique invoice ID to ReceiptMessage.tpl consisting of the contactID & participantID but neither of those fields seemed to be assigned to the smarty template in any format I can guess at. (and since it's an e-mail template I'm struggling to do the smartyDebug=1 thing
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Kiran Jagtap

  • Ask me questions
  • ****
  • Posts: 533
  • Karma: 51
Re: Smarty fields
April 20, 2009, 05:41:30 am
hi

I guess you need to assign contact ID and participant ID to template.
go to CRM/Event/Form/Registration/Confirm.php line around 527 ( v2.1 )

assign these values to template :
Code: [Select]
$this->assign( 'contactID', $contactId );
$this->assign( 'participantID', $participantID );

before sending mail ie before
Code: [Select]
//send Confirmation mail to Primary & additional Participants if exists
CRM_Event_BAO_EventPage::sendMail( $contactId, $this->_values, $participantID, $isTest );
Now you can access these values in template like : {$contactID} and {$participantID}

Also you might want to take a look for inbuilt Invoice id which you might get from $value array.
go to CRM/Event/Form/Registration/Confirm.php line around 432 ( v2.1 )
debug $value array

Code: [Select]
crm_core_error::debug('value', $value );
exit( );
before
Code: [Select]
$contribution =& self::processContribution( $this, $value, $result, $contactID, $pending );


hope this help
kiran






 

You Are Designed To Choose... Defined By Choice.

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Smarty fields
April 25, 2009, 05:09:34 pm
oops caught out - I added the lines to the confirm.php but it doesn't seem to cover administrative registrations as well - sigh. Will have to find it.

NB - it's a nice solution to the need for an invoice number - short, unique & easy ways to search for & access the contribution (views, url substitution)
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Smarty fields
July 24, 2009, 05:33:44 am
Just a note to say that I think the admin registration assignment is in

CRM\Event\Form\Participant.php

ie shortly after
        if ( CRM_Utils_Array::value( 'send_receipt', $params ) ) {

add
             $this->assign('contactID',$contactID);       
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Smarty fields
July 25, 2009, 04:53:26 pm
Eileen - I was in that part of the code for another reason so I added those assigns to the code for 3.0.
http://issues.civicrm.org/jira/browse/CRM-4787

In addition to the contactID assign in CRM/Event/Form/Participant.php, I also put this assign to make the participantID available for offline regisrations:

 $this->assign( 'participantID', $participants[$num]->id );
Protect your investment in CiviCRM by  becoming a Member!

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Smarty fields
August 04, 2009, 07:51:24 pm
I've also added these to Contribute/BAO/ContributionPage.php around line 196 to get the values into the receipt - not sure if it also does off-line receipts.

            $template->assign('contactID',   $contactID);
            $template->assign('membershipID',   $values['membershipID']);
            $template->assign('contributionID',   $values['contribution_id']);
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Smarty fields
August 05, 2009, 04:38:36 pm
Eileen - I've added these for 3.0 as well (for next alpha) - had to make a few changes to your code, and modify Form/Contribution.php as well as Member/Form/Membership.php to cover offline cases.

http://issues.civicrm.org/jira/browse/CRM-4787

I've also made the following variables available in receipts for offline and online transactions:

Event Registration: $contactID, $participantID, $contributionID (if paid)
Contributions: $contactID, $contributionID
Membership: $contactID, $membershipID, $contributionID (online only)
Protect your investment in CiviCRM by  becoming a Member!

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Smarty fields
August 05, 2009, 05:53:48 pm
Why does the contributionID only show if paid? I thought a pending one would exist if not paid? (as long as it's a pay-able event)

Event Registration: $contactID, $participantID, $contributionID (if paid)
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Smarty fields
August 06, 2009, 03:12:04 pm
I mean only if it's a PAID event (contributions are not created for FREE events). :-)
Protect your investment in CiviCRM by  becoming a Member!

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • Smarty fields

This forum was archived on 2017-11-26.