You cannot filter a collection after it has been loaded. Use the event catalog_product_collection_load_before instead. If you attempt to iterate the collection at this point it may call the same event and start an infinite recursion, which would be bad.
The admin_id attribute probably won't be added to the selected columns for product lists unless the attribute has used_in_product_listing set to true. You might also be successful with using $collection->addAttributeToSelect('admin_id') in the same before load event.
I have set up an observer on
catalog_product_collection_load_afterand the following code is called:As you can see, I am filtering the collection on
admin_id, which I created through the following setup script (namespace/module/Resource/Eav/Mysql4/Setup.php).This attribute stores the admin that added the product. However, the collection is not filtered on
admin_id, and in theforeach()loop in the observer method, it returnsNULLrather than the actualadmin_idit should return.Any ideas on why its not working?