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) »
  • Recommended coupon hack broken in 4.2 upgrade
Pages: [1]

Author Topic: Recommended coupon hack broken in 4.2 upgrade  (Read 1123 times)

usr238496

  • I post occasionally
  • **
  • Posts: 85
  • Karma: 0
  • CiviCRM version: latest
  • CMS version: joomla2.5
  • PHP version: 5 something
Recommended coupon hack broken in 4.2 upgrade
November 02, 2012, 07:52:38 am
Anyone else who was using the "official" coupon hack having problems after upgrading? The coupon box now appears twice on the page and doesn't get applied.

Am hoping someone has faced this and solved it and can save me some hassle :)

cheers
You did not answer the verification questions correctly - sigh

usr238496

  • I post occasionally
  • **
  • Posts: 85
  • Karma: 0
  • CiviCRM version: latest
  • CMS version: joomla2.5
  • PHP version: 5 something
Re: Recommended coupon hack broken in 4.2 upgrade
November 02, 2012, 08:06:00 am
so the problem is the duplicate boxes. The first box doesn't work, but the 2nd box does work.

The source code of the page, only shows one input box. Which must one of the boxes is being added by javascript.

You did not answer the verification questions correctly - sigh

usr238496

  • I post occasionally
  • **
  • Posts: 85
  • Karma: 0
  • CiviCRM version: latest
  • CMS version: joomla2.5
  • PHP version: 5 something
Re: Recommended coupon hack broken in 4.2 upgrade
November 02, 2012, 08:32:56 am
Code: [Select]
               $form->addElement( 'text', 'coupon', ts( 'Coupon Code' ) );
 
$template =& CRM_Core_Smarty::singleton( );
$beginHookFormElements = $template->get_template_vars( 'beginHookFormElements' );
if ( ! $beginHookFormElements ) { $beginHookFormElements = array( ); }
$beginHookFormElements[] = 'coupon';
$form->assign( 'beginHookFormElements', $beginHookFormElements );

$coupon = CRM_Utils_Request::retrieve( 'coupon', 'String', $form, false, null, $_REQUEST );
if ( $coupon ) {
$defaults = array( 'coupon' => $coupon );
$form->setDefaults( $defaults );
}

have tried on a new plain event, with no extra fields, and still the input box as added above is duplicated.

If anyone has any ideas would be extremely grateful :)

You did not answer the verification questions correctly - sigh

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: Recommended coupon hack broken in 4.2 upgrade
November 02, 2012, 08:56:46 am

sorry, no idea about your specific issue. BUT we are trying to raise the funds to get the discount module in a  good and complete state. Would help a LOT if folks that are having issue would chip in what they could afford to help the make it happen reach its goal :) We are getting close

http://civicrm.org/content/make-it-happen#discount

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

usr238496

  • I post occasionally
  • **
  • Posts: 85
  • Karma: 0
  • CiviCRM version: latest
  • CMS version: joomla2.5
  • PHP version: 5 something
Re: Recommended coupon hack broken in 4.2 upgrade
November 11, 2012, 05:11:04 am
am just a hired programmer helping out on the coding parts of a web site. I will pass on the request to the powers that be.

Going to be delving into this beast today as others don't seem to be having the issue, so hopefully will be able to post some fixes / hacks that may be of help to others
You did not answer the verification questions correctly - sigh

usr238496

  • I post occasionally
  • **
  • Posts: 85
  • Karma: 0
  • CiviCRM version: latest
  • CMS version: joomla2.5
  • PHP version: 5 something
Re: Recommended coupon hack broken in 4.2 upgrade
November 13, 2012, 04:27:03 am
Might not be related, but this appears above the 2nd input box

Quote
Warning: Invalid argument supplied for foreach() in
Code: [Select]
foreach ($this->_feeBlock as $key => $val) {line 269
administrator/components/com_civicrm/civicrm/CRM/Event/Form/Registration/Register.php on line 272

$this->_feeBlock ==null
You did not answer the verification questions correctly - sigh

usr238496

  • I post occasionally
  • **
  • Posts: 85
  • Karma: 0
  • CiviCRM version: latest
  • CMS version: joomla2.5
  • PHP version: 5 something
Re: Recommended coupon hack broken in 4.2 upgrade
November 13, 2012, 06:42:53 am
incase anyone else has a similar problem, managed to hack a solutio together.

Problem seems to be that everything is being called twice for some unknown (to me) reason. debug_backtrace appeared to dump out the same functions. On the second call to the civi
Code: [Select]
civicrm_buildForm{$formname, $form}
The form object variable _elements did not contain the form elements, it contained just one element, top of my head cannot remember what, maybe hidden_processor, anyway, detect this all but empty var and return out seems to work.


Code: [Select]
               if ( count($form->_elements)== 1 ) {
return;
}

hacky as hell, but works
You did not answer the verification questions correctly - sigh

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviEvent (Moderator: Yashodha Chaku) »
  • Recommended coupon hack broken in 4.2 upgrade

This forum was archived on 2017-11-26.