In this article, I will show you how to make a module which exports products without images into a CSV file. This is a requirement I had to do for one of our recent projects. You might need to have this when you setup products for your online store. I suggest that you should have programming skill to have this done. I will try to make it a module when I have free time.
I assume that you will create one module for it, let's call it "CustomProductExport". In this module, I will write everything in only one file: IndexController.php. You will need other files for your modules, such as config.xml and Namespace_CustomProductExport.
The most important function in controller is exportAction(). In this method, we will get a list of products which do not have images and put them into a CSV file. Here is the PHP code I used to get that list of products.
$catalog_product_entity = $this->_getTableName('catalog_product_entity'); $catalog_product_entity_varchar = $this->_getTableName('catalog_product_entity_varchar'); $image_attribute_id = $this->_getProductAttributeId('image'); $query = "SELECT cpe.entity_id FROM ".$catalog_product_entity." cpe JOIN ".$catalog_product_entity_varchar." cpev ON cpe.entity_id=cpev.entity_id AND cpev.attribute_id=".$image_attribute_id." WHERE cpev.value IS NULL";
And here is how you can put all products in a CSV file.
$file_path = Mage::getBaseDir() . DS .'media' . DS . 'products.csv'; $mage_csv = new Varien_File_Csv(); //mage CSV $mage_csv->saveData($file_path, $products);
I attached my controller file for your reference. After finishing it, you just need to run the action in browser and then download CSV file through FTP client in media folder. Download File.