I want to export all products.
I used this function to get all skus.
function _getConnection($type = 'core_read') {
return Mage::getSingleton('core/resource')->getConnection($type);
}
function _getTableName($tableName) {
return Mage::getSingleton('core/resource')->getTableName($tableName);
}
function _getSku() {
$connection = _getConnection('core_read');
$sql = "SELECT sku
FROM " . _getTableName('catalog_product_entity') . "";
return $connection->fetchAll($sql);
}
/* * ************* CREATE FILE CSV ************************* */
$_skus = _getSku();
foreach ($_skus as $_sku) {
$string = $_sku['sku'] . "\n";
file_put_contents($file, $string, FILE_APPEND);
}
how to change the query so I export SKU, QTY and PRICE ?
1 Answer