include currency country in price

Project:Multi-Currency Support
Component:Code
Category:
Priority:normal
Assigned:Unassigned
Status:active
Description
Project: 
uc_multicurrency

I've greatly modified my site via views and contemplate so if this is already a feature that i've removed my apologies.. I couldn't see anything to accommodate this. Just wondering if it's possible to include the country in the price so people know what form it's in.

Right now my price looks like this:
$99.23

I would like it to look like this:
$99.23 CAD
or
$99.23 USD

Is this possible?

Thanks!
Leetamus

Version: 
Ubercart 1.6
TR
TR's picture
Offline
Bug FinderFAQ ModeratorGetting busy with the Ubercode.
Joined: 11/05/2007
Juice: 3424
Re: include currency country in price

That can be done with a trivial application of Drupal theming, not specific to this module or to Ubercart. Just override theme_uc_product_display_price().

<tr>.
Leetamus's picture
Offline
Joined: 01/21/2009
Juice: 97
Re: Re: include currency country in price
Assigned to:TR» Leetamus

Sorry, my coding knowledge ends at actionscript, I'll try my best to follow up on your suggestion, but realistically it sounds way outside my scope at this point.. I'm a designer who has been dropped into the land of developers. You pull a few tricks at work and they assume it's all no problem, but I'm not able to truly grasp the backend of drupal in general which is why I love things like views which allow me to work the backend without really understanding how it works.

That said, it would seem to me that in a multi-currency environment this is a necessary feature.

Thanks for your hint and responses in general, you do a great job supporting your work which means a lot to a code noob such as myself Eye-wink

If I ever manage to get this working I'll be sure too post how for the next n00b. I can easily just add CAD to the end, but I don't know where to start as far as pulling in the variable from this module that tells which country's currency the customer is using.

an aside: noob came up as misspelled, n00b didn't, HILARIOUS! Laughing out loud

Leetamus's picture
Offline
Joined: 01/21/2009
Juice: 97
Re: Re: Re: include currency country in price

Does anyone know what function/variable stores the site country code? I've gotten this far with my display price over ride.

function etrafficpress_uc_product_display_price($price) {
  $output .= uc_currency_format($price);
  $output .= " ";
  $output .= //country code variable here
  return $output;
}

I'm getting there!

Al
Al's picture
Offline
Bug FinderGetting busy with the Ubercode.Internationalizationizer
Joined: 02/14/2008
Juice: 249
country code variable
Assigned to:Leetamus» Al

I can't test now, but as I found everything in TR's module this should work:

<?php
function etrafficpress_uc_product_display_price($price) {
 
$suffix = uc_get_country_data(array('country_iso_code_2' => uc_multicurrency_get_country()));
 
$output .= uc_currency_format($price);
 
$output .= " ";
 
$output .= $suffix['0']['country_iso_code_3']; // country code variable
 
return $output;
}
?>
Leetamus's picture
Offline
Joined: 01/21/2009
Juice: 97
cheers for that! I was going
Assigned to:Al» Leetamus

cheers for that!

I was going to use this, but yours is probably better formatted:

function theme_uc_product_display_price($price) {
  $output .= uc_currency_format($price);
  $output .= " ";
  $output .= uc_multicurrency_get_country();
  return $output;
}

This would alter the price to

$45.45 US
$45.45 CA

Al
Al's picture
Offline
Bug FinderGetting busy with the Ubercode.Internationalizationizer
Joined: 02/14/2008
Juice: 249
Re: cheers for that! I was going
Assigned to:Leetamus» Al

Well - maybe the code I copied by TR looks more impressive, in fact it returns "USA" and "CAN", so you where much closer Eye-wink

<?php
  $output
.= uc_multicurrency_get_country() .'D';
?>
Leetamus's picture
Offline
Joined: 01/21/2009
Juice: 97
Re: Re: cheers for that! I was going
Assigned to:Al» Leetamus

nice touch Eye-wink