Recent Topics

1 Nov 08, 2017 11:17    

@mgsolipa and @fplanque,

re: inc/locales/_locale.funcs.php

just like with function: locale_datefmt( ) would you consider adding function locale_currency( ) to allow for a default currency unit to be easily called?

Its simple enough to do, but it would be cool if this is just part of the core

something like this:

	function locale_currency( )
	{
		global $Blog;
		
		$UserCache = & get_UserCache();
		$UserCache->clear();
		
		if( ( $owner_User = & $UserCache->get_by_ID( $Blog->owner_user_ID )) === false )
		{
			return '';
		}
		
		$CountryCache = & get_CountryCache();
		
		if( ( $Country = $CountryCache->get_by_ID( $owner_User->ctry_ID, false )) === false )
		{
			return '';
		}
		
		$curr_ID = $Country->curr_ID;
		
		load_class( 'regional/model/_currency.class.php', 'Currency' );
		
		$CurrencyCache = & get_CurrencyCache();
		
		$Currency = & $CurrencyCache->get_by_ID( $curr_ID, false );
			
		if( ( $Currency = & $CurrencyCache->get_by_ID( $curr_ID, false )) === false )
		{
			return '';
		}
	
		return $Currency->code;
		
	}

This is useful for e-commerce

This post has 1 feedback awaiting moderation...


Form is loading...