I'm trying to rewrite the Magento Catalog Product Collection - basically I have a specific filtering rule that must be applied every time a product collection is loaded, so I'm figuring that putting it into the collection directly is the best way of doing it.

However, I've never really played with this before, and I've not been able to get it working so far.

The relevant part of my config.xml is


And for testing, my app/code/local/Lw/Restrict/Model/Resource/Product/Collection.php just contains:

 class Lw_Restrict_Model_Resource_Product_Collection extends Mage_Catalog_Model_Resource_Product_Collection {

     protected function _beforeLoad() {
         echo "Load!!";


So if I go to a category page for example, I'd actually expect the page to die, which it isn't!

Could someone point out whatever obvious thing I've obviously missed is please!!


2 Answers 2


After doing some extra reading, I figured out the XML should look like this:

  • 2
    Yep was just about to put that, but better than using a rewrite would be to use an observer on collection load i.e. catalog_product_collection_load_before. Commented May 19, 2015 at 0:53

Your issue at wrong calling for resource type at config.xml

it should be catalog_resource from catalog.

As per as ,magento catalog_resource resource type class is Mage_Catalog_Model_Resource

See at config.xml of Mage_Catalog Module:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.