Magento: pre filter by multiple option custom attributes

Requirement: pre-filter products by customer group name to product attribute.
I was looking for the “proper” way of filtering items by multiple custom attribute settings, but couldn’t find out how.
So, the following is a brief explanation of how I’ve got this running in Magento 1.4.1.

There are two ways of editing core code in Magento.

  1. Wrong: edit files directly in app/code/core/Mage
  2. Right: extend modules and keep them in app/code/local/MyDevCompany

If you’re in a hurry, you might edit core files directly and then later copy the altered code out into correctly extended module files.
For most of my Magento work, this is the route I have taken: get it working in the core then extend it once I’m sure I’m messing with the correct file/method. Just be sure to copy the code out at some point before upgrading the core!

This is how I have extended _getProductCollection() in app/code/core/Mage/Catalog/Block/Product/List.php – the method which generates the product list when viewing a category.
The extended file would be saved to app/code/local/MyDevCompany/Catalog/Block/Product/List.php

Reason I have used such a long and ugly method: addAttributeToFilter() will only play ball with attribute value IDs.
By fetching possible attribute value text and IDs, flipping the data, we can successfully filter by human readable text.

Further reading on how to set up a module for extension, see