I have created a module with Command which will export all products to CSV and do some custom business rules. It works - however I seem unable to find an efficient way to get select attributes text vs the id.
My data set is roughly 21,000 products.
$productsCollection->addAttributeToSelect('*')
->addFieldToFilter('type_id', ['eq' => 'configurable'])
->addFieldToFilter('status', ['eq' => '1'])
->addFieldToFilter('visibility', ['eq' => '4']);
$count = 0;
while ($page <= $productsCollection->getLastPageNumber())
I loop through sets of 500 products at a time. Notice i'm using a collection and not loading the products individually. This is very fast and all products export in under 2 minutes.
Select attributes have only the id, which is this case is useless. I have tried using $product->getAttributeText('') for only the select attributes, however this is extremely slow. I would actually not recommend anyone use this method for any purpose. It is just a wrapper.
When I incorporate getAttributeText(), the script does not even complete and exhausts 2gb of memory before crashing at 5 minutes.
I could load every product individually, but even then it only contains the id, not the text value, which is important for this use case.
The built in export tool can export the same data quite quickly, is there some kind of taboo around trying to create your own export. Seems like this should be an easy task, but after hours, there is no easy solution, and i'm quite frustrated.