I have a product collection object (Mage_Catalog_Model_Resource_Product_Collection). I am adding various attributes to the select via
How do I remove the default attributes e.g
entity_id, created_at etc, from the collection?
I have tried
removeAttributeToSelect(), but i believe this only removes attributes that have been added by
Sorry, I am the original poster. I thought it would use my other stackexchange account.
I have solved this by using unsetData($key) on the product object, rather than the collection. Unfortunately, this means looping through all the products, so it is rather slow.
And removeAttributeToSelect() does exist....http://doc4dev.net/doc/Magento/1/source-class-Mage_Eav_Model_Entity_Collection_Abstract.html#822-836
If it helps someone, there is a method removeAllFieldsFromSelect. It works well for me. Then you can add only the attributes you need with addFieldToSelect.
$orderCollection->removeAllFieldsFromSelect() ->addFieldToSelect('increment_id') ;
Important notice: field entity_id will be present anyway, removeAllFieldsFromSelect doesn't remove it.