Friday 02 September 2005 5:54:23 am
Im trying to integrate PayPal as well. I noticed that when the request is sent to PayPal (sandbox) it was a generated url something like this: https://www.sandbox.paypal.com/cgi-bin/....&amount=299¤cy_code=NOK Maybe there is a way to generate a identical link with currency in euro, and calculate the amount in euro. Something like this: https://www.sandbox.paypal.com/cgi-bin/....&amount=38¤cy_code=EUR I have included the eurofxref extension in my installation. With this I can calculate the correct price like this:
Price in NOK: {$node.object.data_map.price.content.price}
{def $ini_file=ezini('RegionalSettings', 'Locale')|append('.ini')}
Locale: {$ini_file}
{def $currency_short_name=ezini('Currency', 'ShortName', $ini_file)}
Currency short name: {$currency_short_name}
{let rates=fetch( 'eurofxref', 'fxref' )}
{def $price_norwegian=$node.object.data_map.price.content.price}
{* def $euro=$rates.fx.$currency_short_name|110n( 'number' ) *}
{def $euro=$rates.fx.NOK|110n( 'number' )}
{def $price_euro=div($price_norwegian, $euro)}
Price in Euro: {$price_euro|l10n('clean_currency')}
{/let}
As you can see I'm also trying to fetch the currency short name from the share/locale folder, so this could be dynamic, but it won't fetch the settings. I've tried to locate where the url is generated, but this is done somewhere in the kernel, and I'm not sure how to do this correctly. Does someone have a solution to this, or any ideas?
-Thanks
www.vzt.no
|