Posted: August 26, 2013 at 4:56 am
|
Hi, Is it possible that you include RON as Romanian currency, in orgarnization_config.php? <pre class=”brush: php; gutter: true; first-line: 1; highlight: []; html-script: false”> |
|
<pre class=”brush: php; gutter: true; first-line: 1; highlight: []; html-script: false”> case 'ROM' : $org_options['currency_symbol'] = 'RON'; // Romanian leu |
|
Sorry for not being able to format the code. Actually, it should display ‘lei’ instead of ‘RON’. Thank you. |
|
Final form, while checking other important romanian sites: Lei (with uppercase L) |
|
Also, not all currencies are supposed to be displayed as prefix, but should be as a suffix, and also with a “space” character. E.g.: |
|
Hi Christi, I can certainly request the addition, though when or if it will be added I cannot confirm. From initial looks, I believe at some point in the 4.X series users will have more control over the currency structure, including placement of the currency symbol/code. |
|
What is the recommended way to preserve my custom block code, in case of EE plugin updates, if this is part of /includes/organization_settings.php, organization_config_mnu() function ? |
September 11, 2013 at 11:06 am I can advise not adding the new currency to organization_config.php. Instead you can use a custom function and place it inside /wp-content/uploads/espresso/custom_functions.php: function my_change_ee_currency( $content ) { global $org_options; $base = $org_options['currency_symbol']; $replace = '<span class="currency">Lei</span>'; $content = str_replace( $base, $replace, $content ); return $content; } add_filter( 'the_content', 'my_change_ee_currency', 11 ); This will do two things: 1) Do a string replace and display your currency is display 2) wrap the currency letters in a span tag with a class of “currency” to allow positioning it to the right side of the price value with CSS. |
|
|
Nice idea, I start to understand how to customize these aspects. But: <code><p id="p_event_price-2" class="event_price"> <span class="section-title">Price: </span> <span class="currency">Lei</span>12.00</p></code> Secondly, the ‘the_content’ filter hook works for any EE aspect? like the following content types: email Wouldn’t it be better to write some init hook as to set the |
|
Hi, I would say that you would most likely need to edit the template files, for instance, in the event list the price is shown via this code event_cost; ?> swapping the position of the $org_options[‘currency_symbol’] and the event cost will display them the way you want to. Due to the way the plugin is made, you will need to do this in both the event_list_display.php and registration_page_display.php but there may be other places as well, tickets and invoice for example. the_content is WordPress core so it will affect only post and pages to my knowledge
I believe we are looking at making it easier for international users to modify the cost structure at some point in version 4, as we know the standard UK/US format isn’t ideal for the rest of the world. |
|
Let’s say that for this stage I would be satisfied to set the |
September 23, 2013 at 11:03 am Hi Cristi, I don’t believe the currency options can be changed via an action hook. To follow up with your CSS question, yes, you can use the classname in the example code to float the span right/left or position it to your specifications. |
|
|
Currently adopted solution for setting the currency (no CSS yet) and covering all relevant places, was to add to my custom gateway, in settings.php, that when the gateway settings are saved, then the currency is set accordingly: <code> // set Lei as currency $org_options = get_option('events_organization_settings'); $org_options['currency_symbol'] = ' Lei '; update_option('events_organization_settings', $org_options);</code> I will check the CSS span feature sometime later. |
|
Thanks for sharing your solution. |
|
There is still a problem, that whenever I save the organization settings, it puts again the $ sign as currency… I would really like to settle this somehow, without altering EE core php pages… |
You can avoid altering core Event Espresso functions and use your specified currency by using the custom function I suggested in this post: https://eventespresso.com/topic/new-currencies-in-organization_config-php/#post-58767 Then you can use your currency within the gateway (and avoid using the currency set in Event Espresso>General options). |
|
|
September 29, 2013 at 10:56 am All the solutions mentioned so for do not cover both requirements: As a result, I had to investigate further so here is the solution which _really_ works for setting ‘Lei ‘ currency (no CSS manipulation yet). <pre class=”brush: php; gutter: true; first-line: 1; highlight: []; html-script: false”><?php /* $currency_format = getCountryFullData($newvalue['organization_country']); if (strcasecmp($currency_format['iso_code_3'], 'ROM') == 0) return $newvalue; add_filter('pre_update_option_events_organization_settings', 'RON_currency_for_Romania', 10, 2); |
|
September 30, 2013 at 12:40 am The right alignment of the currency symbol was solved using php regular expression replace, covering posts and pages. Invoice and email will be treated separately. The following code has been added to custom_functions.php. /* global $org_options; $base = $org_options[‘currency_symbol’]; $content = preg_replace( ‘/(‘ . $base . ‘) *([0-9.,]+)/’, ‘$2 $1’, $content ); return $content; } add_filter( ‘the_content’, ‘align_currency_right’, 11); |
The support post ‘New currencies in organization_config.php’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.