I'm possibly being a bit dim and just not seeing it, but is it possible to set prices for a product in Euros and GB Pounds (say), and allow the user to choose which currency they wish to use?
Multiple currencies for products
|
|
Multi currency is not available in ubercart. The only way to do that would be to develop a module...
Is that true? And if so, will multi currency be supported some day by Ubercart?
Some stores may sell products from suppliers in different currencies. Their products would need updating at regular intervals to take into account currency fluctuations.
Is that true? And if so, will multi currency be supported some day by Ubercart?...
Someday, if somebody develop a module that do it... 
You're wrong, rich.
The way multi currencies work is to have a default currency specified for each product within a store and then if customer change his own default currency - he will see a result of currency conversion. Have you posted here for advertising purpose?
But this is definitely would be useful to have this module - as selling within one country isn't actual these days. So I suggest to create a team who will be developing the currency module - otherwise we will wait for years...
If somebody wants to participate in development - please post here for a beginning.
Hi ivan.g, I posted here because one of our clients source their products from different countries, Japan, UK and USA. They sell their products in GBP so need a way to display their product prices taking into account currency fluctuations. They don't need customers to be able to buy products in their chosen currency but I agree that this would certainly be a useful addition to Ubercart.
Ivan.g! I am in your team.
I need to have this module in a 2 or 3 weeks - so i want to partisipate in your team.
I write modules for drupal but not for ubercart.
One more question - where are tour from? I am from Ukraine.
I have developing site for client that needs to set different currency for products in one stock. I have developed some modules for Drupal 5 & 6 for my own needs and I think that I can help us with developing multicurrency module for Ubercart.
I am from Russia, Nizhniy Novgorod.
P.S. Sorry for my English 
I try to hook an array before render a product rendering form, but I can't found any hook to do this! When Drupal shows node edit form (node type is product), it calls function uc_product_form (setted in uc_product_node_info function) but this function have no hooks!
Have anybody some ideas how we can hook node render process and add additional currency fields?
I think function uc_product_form needs something like this before 'return $form;':
foreach (module_implements('product_edit_form') as $module) {
$function = $module .'_product_edit_form';
$form = array_merge($form, (array) $function($form));
}Because without this I can't found any method to hook product edit form.
Drupal provides hook_form_alter(), which is how the shipping modules add in their fieldsets. These functions have access to all of the product fields, but they choose to ignore them for the most part.
hook_form_alter() basically does what you proposed, but for every form identified by the $form_id.
Function hook_form_alter() hooks all of Drupal forms, that it have a great number. And, I think, when I add new function to hook_form_alter, this will have a negative impact on all form perfomance, because calling product edit form is less frequently than other forms.
But at now I try to use hook_form_alter() in my module...
I create some multicurrency functional in my module. Module is in alpha development stage, don't use it on work sites!
It can set product prices in custom currency and convert display price to selected currency. On my test site all works properly.
List of available currency and exchange rates at now is only in source code, file uc_currency.module.
I try to use currency drupal module API (function currency_api_convert()) but it is too slow (it is ask Yahoo site for every conversion), so for testing I write an easy equivalent function in my module.
Filter for available currency in product edit form ($currency_enabled):
function uc_currency_filter($currency) {
$currency_enabled=array(
'USD'=>'',
'EUR'=>'',
'RUB'=>'',
);
return array_intersect_key($currency,$currency_enabled);
}Exchange rates ($values):
function currency_api_convert($currency_from, $currency_to, $amount = 1) {
if($currency_from==$currency_to) return $amount;
$equivalent='RUB';
$values=array(
'USD' => 24.6325,
'EUR' => 35.9832,
'RUB' => 1,
);
if(!($values[$currency_from] && $values[$currency_to]))return -1;
return $amount*$values[$currency_from]/$values[$currency_to];
}Values you can set relative to any currency.
Waiting for you comments and ideas.
| Attachment | Size |
|---|---|
| uc_currency_5.x-1.x-dev-0.1.tar.gz | 2.32 KB |
It won't have a noticeable impact. Just wrap all your code in an if statement checking against the form ID:
<?php
function example_form_alter($form_id, &$form) {
if ($form_id == 'the_form_id') {
// Code goes here. 
}
}
?>Most implementations I've seen of hook_form_alter() are just changing a single form. Of course, they're just testing a single $form_id, and not several like the product forms. I'm not too concerned about the performance because all of the node type info is cached in memory, and I trust in_array() to be efficient.
It would be nice to have an administration form for this module - where we can set a range of currencies and its rates
Does this module try to implement the following?
http://www.ubercart.org/forum/development/3194/how_implement_currency_mo...
*subscribe*
Yeah i need to do this too, will be a good thing to have in ubercart.
matt
I too am currently working on a site that needs similar functionality. I am going to attempt to write a module to handle it. I think it'll be pretty straight-forward, and if I succeed, I'll definitely post the module here.. stay tuned, it shouldn't take too long.
-Rob
Cool, thanks.
I remember a nice feature in osCommerce was that you could set a standard currrency, then have it pop over to xe.com and check the exchange rates for other currencies, if that could be set up as a cron job it would be sweet. I seem to remember you could also add on a variable percentage to account for the hastle incured of people paying with other currencies, eg cost to convert to your currency.
What does the Locale module do? I guess it only handles the translations.
Good luck
m
-Rob
This is something I'd also find useful, and I can envisage it working in a couple of different ways:
Currency selection
- Allow user-selected currency(s)
- Allow only Admin-selected currency(s)
Currency display
- Show just one price (EITHER the default currency, OR the alternative currency(s) )
- Show more than one price (ie the default currency, AND the alternative currency(s) )
Currency conversion
- Convert default currency either (a) using Currency exchange module, or (b) Manually (ie. admin specifies the conversion value)
- After converting currency, (a) add/subtract result by a fixed or % amount, (b) round the result EITHER up or down, to the nearest 0.05 or 0.10 or 0.25 etc.
Just my two cents worth (or 0.1 Euro, or 0.15 pence, worth).
Hi, I'd also love module with similar functionality as iantresman asks for and I'm ready to help. The problem is, that i don't know the current state of matters, latest post on this topic is almost two months old. So could someone drop me a line about what's currently going on and how can I help? I need those functionalities as soon as possible so I'm goging to implement some dirty and fast temporary solution, because tomorow I'm going on holiday for a month, but when I return, we can realy focus on it and make clean elagant and fast wich ubercart could proud of 
How far did you guys get?
I'm having the same need.
I have a solution that I will release as soon as my client signs off on it.
Hi TR,
what about your solution? I am sure you would make a lot of people really happy 
I still haven't gotten around to getting it in Drupal CVS, but I've just posted it in the Ubercart.org contributions section for your enjoyment: http://www.ubercart.org/contrib/6102
I would appreciate any feedback.
Thank you very much. I will make a project soon that request this feature, I will stay you informed.
If UC2.0 progress quickly, I even plan to do it directly with D6 and UC2, so I will port your module to 6.x ^^
thank you again for this usefull feature !
|
|








Joined: 09/25/2007