Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Access Magento exchange rate from external script
 
wriggler
Jr. Member
 
Total Posts:  13
Joined:  2008-12-02
 

Hi,

I need to create a PHP script that will allow me to convert prices using the same rates as are stored in my Magento shop, but from outside Magento.

I will be adding products dynamically and need to ensure the prices are consistent wherever they are shown on my site.

I know this would probably need mage.php, then somehow accessing the currency classes… but i don’t know how to do that. Can anybody help me work out how I could access this function in Currency.php?

(FROM CURRENCY.PHP)
/**
* Convert price to currency format
*
* @param double $price
* @param string $toCurrency
* @return double
*/
public function convert($price, $toCurrency=null)

Thanks in advance for any suggestions!

Matt

 
Magento Community Magento Community
Magento Community
Magento Community
 
Damian Culotta
Enthusiast
 
Total Posts:  878
Joined:  2008-12-10
Argentina
 

I’m not sure if I understood your idea.
But maybe you can look at the directory_currency_rate table into your database.
There you can find the currency rates.

 
Magento Community Magento Community
Magento Community
Magento Community
 
wriggler
Jr. Member
 
Total Posts:  13
Joined:  2008-12-02
 

Perfect! I hadn’t found that table - a much simpler solution. Thanks.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top