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 CiviContribute (Moderator: Donald Lobo) »
  • Adding dollar sign to "Other Amount"
Pages: [1] 2

Author Topic: Adding dollar sign to "Other Amount"  (Read 4258 times)

bcobin

  • I post frequently
  • ***
  • Posts: 337
  • Karma: 9
    • InterCreative Media
  • CiviCRM version: 4.3.3
  • CMS version: Drupal 7.22
  • MySQL version: 5.5.9
  • PHP version: 5.3
Adding dollar sign to "Other Amount"
January 04, 2013, 08:37:16 am
This is one of the dumbest things I've run into, but there's no substitute for real-life user experience.

After some investigation, I've found that some people have been entering in the dollar sign in the "Other Amount" field and, predictably, the transaction fails. An easy fix would to change the label so that is says "Other Amount $" instead of simply "Other Amount," but I can't figure out how to do this.

Another note: This is a mutilingual site, so I'm using the change from http://issues.civicrm.org/jira/browse/CRM-11433 so that the "Other Amount" field gets translated.

Any ideas? Thanks much...

Jason W

  • I post frequently
  • ***
  • Posts: 197
  • Karma: 12
  • jason@civitrainingtutorials.com
  • CiviCRM version: 4.2
  • CMS version: Drupal 7
  • MySQL version: 5.x
  • PHP version: 5.x.x
Re: Adding dollar sign to "Other Amount"
January 08, 2013, 01:34:43 pm
Hello bcobin,

Unless you know where to find the Other Amount field (in which case you can Edit it and add $ to the label) Try setting up a word replacement that replaces "Other Amount" with "Other Amount $".

Hope this helps.

Cheers,
Jason
civiTrainingTutorials
"Helping You Help Others"

bcobin

  • I post frequently
  • ***
  • Posts: 337
  • Karma: 9
    • InterCreative Media
  • CiviCRM version: 4.3.3
  • CMS version: Drupal 7.22
  • MySQL version: 5.5.9
  • PHP version: 5.3
Re: Adding dollar sign to "Other Amount"
January 08, 2013, 03:48:16 pm
Thanks, Jason - that wouldn't work, unfortunately.

There's an "Other Amount" checkbox below the dollar amounts which is perfectly fine - one wouldn't want to have the dollar sign there. Where the user would enter the "Other Amount" is where the dollar (or applicable currency) sign should go.

I haven't yet had to work with word replacement, but I would assume any word replacement would replace both strings.

Nice try, though!

I would classify any reason that might case a transaction to fail (no matter how dumb) is pretty important, actually, and I only found out about this one because the client took the time to walk the contributor through it. It happened to be his Mom - this is the sort of case where one would normally never find out about the issue and the contribution would probably just be lost.

Can it be that hard to find out where the text is coming from? Gosh... thanks!

Yashodha Chaku

  • Forum Godess / God
  • Ask me questions
  • *****
  • Posts: 755
  • Karma: 57
    • CiviCRM
Re: Adding dollar sign to "Other Amount"
January 09, 2013, 05:27:17 am
bcobin :

I have fixed the same for 4.3

Meanwhile you can look at the patch here :

https://fisheye2.atlassian.com/changelog/CiviCRM?cs=44693

It makes sure the currency with other amounts is the one that's the selected currency instead of hardcoding.

HTH
-Yashodha
Found this reply helpful? Contribute NOW and help us improve CiviCRM with the Make it Happen! initiative.

bcobin

  • I post frequently
  • ***
  • Posts: 337
  • Karma: 9
    • InterCreative Media
  • CiviCRM version: 4.3.3
  • CMS version: Drupal 7.22
  • MySQL version: 5.5.9
  • PHP version: 5.3
Re: Adding dollar sign to "Other Amount"
January 09, 2013, 05:37:05 am
Thank you, Tashodha!

But could you check the link you posted? It doesn't seem to go anywhere - perhaps a typo... thanks!

Yashodha Chaku

  • Forum Godess / God
  • Ask me questions
  • *****
  • Posts: 755
  • Karma: 57
    • CiviCRM
Re: Adding dollar sign to "Other Amount"
January 09, 2013, 05:45:50 am
The link is correct, fisheye will take some time to load the patch.

Should be there in half an hour or so.

-Yashodha
Found this reply helpful? Contribute NOW and help us improve CiviCRM with the Make it Happen! initiative.

Yashodha Chaku

  • Forum Godess / God
  • Ask me questions
  • *****
  • Posts: 755
  • Karma: 57
    • CiviCRM
Re: Adding dollar sign to "Other Amount"
January 09, 2013, 05:46:58 am
Here's the patch, you can have a look :

Code: [Select]
Index: CRM/Price/BAO/Field.php
===================================================================
--- CRM/Price/BAO/Field.php (revision 44692)
+++ CRM/Price/BAO/Field.php (working copy)
@@ -253,7 +253,8 @@
 
     $otherAmount = $qf->get('values');
     $config = CRM_Core_Config::singleton();
-    $qf->assign('currencySymbol', CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_Currency',$config->defaultCurrency,'symbol','name') );
+    $currencySymbol = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_Currency',$config->defaultCurrency,'symbol','name');
+    $qf->assign('currencySymbol', $currencySymbol);
     // get currency name for price field and option attributes
     $currencyName = $config->defaultCurrency;
 
@@ -286,8 +287,14 @@
 
         $extra = array();
         if (property_exists($qf,'_quickConfig') && $qf->_quickConfig && property_exists($qf,'_contributionAmount') && $qf->_contributionAmount) {
+          foreach($fieldOptions as &$fieldOption) {
+            if ($fieldOption['name'] == 'other_amount') {
+              $fieldOption['label'] = $fieldOption['label'] . '  ' . $currencySymbol;
+            }
+          }
Found this reply helpful? Contribute NOW and help us improve CiviCRM with the Make it Happen! initiative.

bcobin

  • I post frequently
  • ***
  • Posts: 337
  • Karma: 9
    • InterCreative Media
  • CiviCRM version: 4.3.3
  • CMS version: Drupal 7.22
  • MySQL version: 5.5.9
  • PHP version: 5.3
Re: Adding dollar sign to "Other Amount"
January 27, 2013, 12:21:51 pm
Sorry for the late response, but I needed to wait until I could take the site offline.

I tried manually making the change for 4.2.7, but got the following error:

Code: [Select]
Fatal error: require_once() [function.require]: Failed opening required 'CRM/Financial/DAO/Currency.php' (include_path='/home/solcom/public_html/sites/all/modules/civicrm/drupal/modules/civicrm_engage/:.:/home/solcom/public_html/sites/all/modules/civicrm:/home/solcom/public_html/sites/all/modules/civicrm/packages:.:/usr/lib/php:/usr/local/lib/php') in /home/solcom/public_html/sites/all/modules/civicrm/CRM/Core/DAO.php on line 764
I see this is for 4.3 - is there a way to use the same method for 4.2.7? Anyway, thank you so much for doing this - greatly appreciated. If I have to wait until 4.3 it is hardly the end of the world!

Yashodha Chaku

  • Forum Godess / God
  • Ask me questions
  • *****
  • Posts: 755
  • Karma: 57
    • CiviCRM
Re: Adding dollar sign to "Other Amount"
January 29, 2013, 06:06:40 am
bcobin :

You might wanna use CRM_Core_DAO_Currency instead for 4.2.x

HTH
-Yashodha
Found this reply helpful? Contribute NOW and help us improve CiviCRM with the Make it Happen! initiative.

bcobin

  • I post frequently
  • ***
  • Posts: 337
  • Karma: 9
    • InterCreative Media
  • CiviCRM version: 4.3.3
  • CMS version: Drupal 7.22
  • MySQL version: 5.5.9
  • PHP version: 5.3
Re: Adding dollar sign to "Other Amount"
August 13, 2013, 04:11:18 pm
Different site now - I'm on 4.3.4 and this still isn't working - I've tried both the 4.3.4 code (where I see much of what's in the patch) and the code from https://fisheye2.atlassian.com/changelog/CiviCRM?cs=44693 and can't get the dollar sign to appear.

I ran into this myself when testing the site - as dumb as this is, you really don't want the user to have any errors on a contribution page!

This seems to work OK on the demo site, though (which also looks like it's running 4.3.4) - could this be because there are two enabled currencies? I'm only using US$.

Any help greatly appreciated... thanks!

joelcomit

  • I’m new here
  • *
  • Posts: 14
  • Karma: 0
  • Owner/Designer/Developer at Comit Strategies
    • Comit Strategies
  • CiviCRM version: 4.5.5
  • CMS version: WordPress 4.1
  • MySQL version: 10.0.14-MariaDB
  • PHP version: 5.4.34
Re: Adding dollar sign to "Other Amount"
February 07, 2014, 09:49:53 am
Just wanted to bump this topic up. Having same issue of no currency sign next to other amount field. Some have typed a $ sign in and received an error. Obviously we don't want this happening. Any solutions?

bcobin

  • I post frequently
  • ***
  • Posts: 337
  • Karma: 9
    • InterCreative Media
  • CiviCRM version: 4.3.3
  • CMS version: Drupal 7.22
  • MySQL version: 5.5.9
  • PHP version: 5.3
Re: Adding dollar sign to "Other Amount"
February 07, 2014, 09:53:41 am
I ended up "solving" this by using an image of a dollar sign and CSS. Insofar as I'm not using multiple currencies, this worked for me, but it's certainly a hack.

Obviously not the best solution, but in a pinch...

Sean Madsen

  • I post occasionally
  • **
  • Posts: 98
  • Karma: 5
  • CiviCRM implementer/developer
    • Bikes Not Bombs
  • CiviCRM version: 4.6
  • CMS version: Drupal 7
Re: Adding dollar sign to "Other Amount"
April 23, 2014, 08:25:15 am
Bump.

I just found this thread after getting reports from multiple users, confused about why the website didn't accept their donation. I can only imagine that for each of the three people that contacted me about it in the past month, there are many more who just gave up and never said anything. Seems like a pretty serious issue.

I think Civi core should receive a fix to display the currency symbol before currency fields on donation forms

AND

Civi should also ACCEPT donations entered with the currency symbol. Can't be that hard, right?

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: Adding dollar sign to "Other Amount"
April 23, 2014, 08:47:20 am

hey sean:

agreed. would be nice to have both those fixes in civi core

can you please submit a patch to fix them

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

bcobin

  • I post frequently
  • ***
  • Posts: 337
  • Karma: 9
    • InterCreative Media
  • CiviCRM version: 4.3.3
  • CMS version: Drupal 7.22
  • MySQL version: 5.5.9
  • PHP version: 5.3
Re: Adding dollar sign to "Other Amount"
April 23, 2014, 10:13:21 am
I ended up with a temporary workaround using CSS:

Code: [Select]
#price_3 {
background: transparent url(img/dollar_sign_opt.png) 0 center no-repeat;
padding-left: 14px !important;
}

You would need to identify the field(s) in question and, of course, this will only work if you're using a single currency, but at least it got me through. Hope this helps and good luck!

Pages: [1] 2
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviContribute (Moderator: Donald Lobo) »
  • Adding dollar sign to "Other Amount"

This forum was archived on 2017-11-26.