Created
November 29, 2022 10:56
-
-
Save magefast/17e161c28e59195ac7b1f4c2d6b80366 to your computer and use it in GitHub Desktop.
Revisions
-
magefast created this gist
Nov 29, 2022 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,41 @@ <?php error_reporting(E_ALL); ini_set('display_errors', '1'); ini_set('max_execution_time', 1000); require_once dirname(__FILE__) . './../app/Mage.php'; Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID); $productsCollection = Mage::getModel('catalog/product')->getCollection() ->addAttributeToSelect('sku') ->addAttributeToSelect('name') ->addAttributeToSelect('shtrikh_kod') ->addAttributeToSelect('price'); $array = []; foreach ($productsCollection as $product) { $array[] = [ 'sku' => $product->getData('sku'), 'name' => $product->getData('name'), 'shtrikh_kod' => $product->getData('shtrikh_kod'), 'price' => $product->getData('price') ]; } unset($productsCollection); addToCsv($array); die('done'); function addToCsv($array) { $class = new Varien_File_Csv(); $newCsvData = array(); foreach ($array as $a) { $newCsvData[] = $a; } $class->saveData(Mage::getBaseDir() . DS . 'var' . DS . 'report.csv', $newCsvData); unset($class); }