UberCart for Drupal has some difficulties with currencies. However, by overriding "uc_currency_format", you can at least do some background calculation to give you a good estimate of the converted value. However, as it's part of UberCart Core, you can't edit the file, So you risk losing your code after every update. Also, this function does not have a hook!
That means the only that I can think of dealing with this, is having a module that overrides the function. So my question is...
Is there a way to override an existing PHP function? For example, I have:
function uc_currency_format($value, $sign = TRUE, $thou = TRUE, $dec = NULL)
{
// dont do this
}
But when this gets called, I want it to instead execute this
function uc_currency_format_rewrite($value, $sign = TRUE, $thou = TRUE, $dec = NULL)
{
// do this
}
Is that possible?
It seems to be one of those very rare times you need to hack the core code. When it comes to this, I try to limit the impact at minimum like this:
This way, you will have your own code running.
At next update, you will see in your testing environment (always better to test, before applying updates to production sites) a duplicate function name fatal error. If your hook has not been implemented yet, you will rename the original fuction, again.
This method is not defined in the best practice, of course. Use it at your own risk.