Last active
December 30, 2015 03:29
-
-
Save tawfekov/7769595 to your computer and use it in GitHub Desktop.
update magento currency via cron or simple php script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include("app/Mage.php"); | |
Mage::app(); | |
$now = new \DateTime(); | |
echo "start downloading rates : {$now->format("Y-m-d H:i:s")}\n"; | |
$model = Mage::getModel("directory/currency"); | |
$currency_converter= Mage::getModel("directory/currency_import_webservicex"); | |
$rates = $currency_converter->fetchRates(); | |
echo json_encode($rates) . "\n"; | |
echo "has been downloaded\n"; | |
echo "start saving rates to db \n"; | |
$model->saveRates($rates); | |
$finished = new \DateTime(); | |
echo "finsihed saving rates to db on : {$finished->format("Y-m-d H:i:s")} \n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment