Magento and Google Products - How do I get the right currency based on location?

352 views Asked by At

I have a script that pulls product data from Magento and creates a flat file for Google Products to use.

The problem is that the base currency of the site is Euro but I need to give Google the prices in Sterling. The script works fine if I send the request to the script from a UK-based IP address. However when Google runs the script automatically it always get Euro prices from the script.

I realise that, depending on IP location, Magento will serve different prices. But I want to force the script to always pull Sterling prices. The functions I'm using are:

$products = Mage::getModel('catalog/product')
                    ->getCollection()
                    ->addAttributeToSelect('*');
$product->getPrice();

Is there a way of setting a locale or specifying a currency?

1

There are 1 answers

0
ʍǝɥʇɐɯ On

How are your prices defined? Are they converted on the fly to different currencies or entered on a per-website basis?

Also, it is not standard for Magento to serve up a different currency based on IP address - that is some custom code.

Regardless, you can set the store and the website and the store view in your script. Try:

$products = Mage::getModel('catalog/product')
                ->setStoreId($store) 
                ->getCollection()
                ->addAttributeToSelect('*');
$product->getPrice();