Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $session = Mage::getSingleton('customer/session');
- if ($session->isLoggedIn()) {
- $countryCode = $session->getCustomer()->getDefaultBillingAddress()->getCountry();
- $usdPrice = Mage::helper('core')->currency($_product->getFinalPrice(),false);
- if($countryCode == "GB") {
- if(!function_exists(convertCurrencyGb)) {
- function convertCurrencyGb($amount, $from, $to){
- $data = file_get_contents("https://finance.google.com/finance/converter?a=$amount&from=$from&to=$to");
- preg_match("/<span class=bld>(.*)</span>/",$data, $converted);
- $converted = preg_replace("/[^0-9.]/", "", $converted[1]);
- return number_format(round($converted, 3),2);
- }
- $newprice = convertCurrencyGb($usdPrice, "USD", "GBP");
- }
- echo ' <div class="test" style="display: none;">';
- echo $newprice;
- echo '</div>';
- }
- }
- ?>
Add Comment
Please, Sign In to add comment