User Tools

Site Tools


urapidflow:v2:export-currency

Export Currency Formatted Numbers

urapidflow.php
<?php
 
// initialize Magento environment
 
include_once "app/Mage.php";
Mage::app('admin')->setCurrentStore(0);
 
$helper = Mage::helper('urapidflow');
 
// run profile using name (this profile exports to var/urapidflow/export/products.csv):
 
$helper->run("Export Products");
 
// post-process the file to format currency (stream for lower memory footprint):
// (assuming that the script is in magento root folder)
// in this example column 5 (starting from 0) is the price that need to be formatted
 
$from = fopen('var/urapidflow/export/products.csv');
$to = fopen('var/urapidflow/export/products1.csv');
while ($row = fgetcsv($from)) {
    $row[5] = number_format($row[5], 2, ',', ' ');
    fputcsv($to, $row);
}
fclose($from);
fclose($to);
urapidflow/v2/export-currency.txt · Last modified: 2017/10/03 02:31 by unirgy