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 »
  • Upgrading CiviCRM (Moderator: Deepak Srivastava) »
  • Civicrm 4.4 -> 4.5 Group-Based-Pricing Extension Broken
Pages: [1]

Author Topic: Civicrm 4.4 -> 4.5 Group-Based-Pricing Extension Broken  (Read 468 times)

DerekL

  • I post frequently
  • ***
  • Posts: 132
  • Karma: 1
  • CiviCRM version: 4.5.5
  • CMS version: Drupal 7.34
  • MySQL version: 5.1.54
  • PHP version: 5.2.17
Civicrm 4.4 -> 4.5 Group-Based-Pricing Extension Broken
January 20, 2015, 10:57:40 am
Hi there,

I currently use the CiviCRM Group-Based Pricing (https://civicrm.org/extensions/group-based-pricing) extension to handle members-only pricing. Upon upgrading to 4.5, the additional form fields in the "Edit Price Field" screen no longer show up. 

This extension includes a template under templates\CRM\Price\Form\Option.tpl that adds the following code to be bottom of the options table:

Code: [Select]
{* Limit Prices by Group: Start of code addition *}
      {if $action eq 2}
          <tr class="crm-price-option-form-groupprice_gids"></tr>
          <td class="label">Limit Price Option To:</td>
          <td>{$form.groupprice_gids.html}</td>
          </tr>
          <tr class="crm-price-option-form-groupprice_gids"></tr>
          <td class="label">Negate Price Group Limit:</td>
          <td>{$form.groupprice_negate.html}</td>
          </tr>
      {/if}
      {* Limit Prices by Group: End of code addition *}

Which seems to not be loading anymore.

Does anyone have any idea as to how I could go about figuring out what changed between 4.4 and 4.5 that made this template no longer load?

Cheers,
-d

Update: Forgot to mention: I went ahead and updated the Option.tpl to match the core version, adding the necessary code snippet, but it doesn't seem to be loading at all. 

Update Two: I stepped through the entire execution of editing a price field and have found that Option.php is no longer being used for the generation of the form, having been replaced with Field.php. Placing the extension  code as-is into field.tpl shows new option field labels, but not the actual fields.  Doing a {debug} in Fields.tpl shows me that the required variables inside $form are not being loaded. Deeper into the rabbit hole I go...
« Last Edit: January 21, 2015, 10:23:29 am by DerekL »

DerekL

  • I post frequently
  • ***
  • Posts: 132
  • Karma: 1
  • CiviCRM version: 4.5.5
  • CMS version: Drupal 7.34
  • MySQL version: 5.1.54
  • PHP version: 5.2.17
Re: Civicrm 4.4 -> 4.5 Group-Based-Pricing Extension Broken
January 22, 2015, 12:20:50 pm
Ok, I've gotten the extension working for the most part.
Some variable names got moved around.

I do have one open issue though, unsetting a price field entry in the $amount array removes the field from the form, but the amount labels persist. 

The civicrm hook I'm using, hook_civicrm_buildAmount, hasn't changed between 4.4 and 4.5 according to the documentation.

I've tried changing the is_display_amounts'] = 0, tampering with the $form object, among others, but I can't seem to get the amounts to go away.

Any ideas?

Code: [Select]
//original line to remove price field from $amount, doesnt work to hide field anymore.
          //unset($amount[$amount_id]['options'][$priceOption['id']]);

          //modified line to remove price field from $amount, works but leaves form labels.
          unset($amount[$amount_id]);

          //works to change priceOption label.
          //$amount[$amount_id]['options'][$priceOption['id']]['label']= ts( 'Power of hooks' );

          //does not work to remove amount, though it is removed from array.
          //unset($amount[$amount_id]['options'][$priceOption['id']]['amount']);

          //does not work to set amount to zero, though array is tampered with successfully.
         //$amount[$amount_id]['options'][$priceOption['id']]['amount']='0';
         
          //does not work to hide amounts.
          //$amount[$amount_id]['is_display_amounts'] = '0';
« Last Edit: January 22, 2015, 12:34:37 pm by DerekL »

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Upgrading CiviCRM (Moderator: Deepak Srivastava) »
  • Civicrm 4.4 -> 4.5 Group-Based-Pricing Extension Broken

This forum was archived on 2017-11-26.