Skip to content

Instantly share code, notes, and snippets.

@mcjwsk
Created July 23, 2015 07:44
Show Gist options
  • Save mcjwsk/b488f716f2d18fad3772 to your computer and use it in GitHub Desktop.
Save mcjwsk/b488f716f2d18fad3772 to your computer and use it in GitHub Desktop.
<?php
set_time_limit(600);
define('MAGENTO_ROOT', getcwd());
$compilerConfig = MAGENTO_ROOT . '/includes/config.php';
if (file_exists($compilerConfig)) {
include $compilerConfig;
}
$mageFilename = MAGENTO_ROOT . '/app/Mage.php';
if (!file_exists($mageFilename)) {
if (is_dir('downloader')) {
header("Location: downloader");
} else {
echo $mageFilename . " was not found";
}
exit;
}
require_once $mageFilename;
Mage::app()->setCurrentStore(Mage::getModel('core/store')->load(3));
$collection = Mage::getModel('catalog/product')->getCollection();
$data = array();
foreach ($collection as $product) {
$data[] = array(
'sku' => $product->getSku(),
'price' => $product->getPrice(),
'special_price' => $product->getSpecialPrice(),
);
}
file_put_contents('product_price.json', json_encode($data));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment