1
votes

When I try to create a configurable product from the admin panel I am getting the following error.

Fatal error: Call to a member function setProductFilter() on a non-object

I am not trying anything special. I just went to "Add Product" and selected "Default" attribute set and selected "Configurable Product" from the drop down and hit continue. But I could not create configurable products.

It is showing error in the following line

\app\code\core\Mage\Catalog\Model\Product\Type\Configurable.php on line 294

Could anyone help me in this please?

2
Do you have any 3rd party modules installed that might alter the product saving methods?sulman
Try disable all custom modules (if any), to see if one of them is causing this issueRenon Stewart
Yes right. I have installed a Multi Vendor Plugin. Let me disable that check. But in my local machine Windows, I am getting this error. But in the server Linux it is working fine! Any guess?Lakshmi Swami Nathan

2 Answers

0
votes

Almost 2 years on and I have just encountered the same (well, a very similar) problem in Magento 1.9.0.1. I found the cause, and it came as quite a surprise.

Note: I'm using backslashes in my filepaths because I'm using Windows. I see the OP was too. Just in case anyone was about to point out my "mistake". :o)

\app\code\core\Mage\Catalog\Model\Product\Type\Configurable.php on line 294 looks like this:

return Mage::getResourceModel('catalog/product_type_configurable_attribute_collection')->setProductFilter($this->getProduct($product));

This is supposed to do the following 3 things:

  1. Load the product object using$this->getProduct($product)
  2. Generate a resource object using Mage::getResourceModel('catalog/product_type_configurable_attribute_collection')
  3. Call that resource object's setProductFilter method, passing in the product object

It's failing at step 2, because Mage::getResourceModel('catalog/product_type_configurable_attribute_collection') tries to use the file \app\code\core\Mage\Catalog\Model\Resource\Product\Type\Configurable\Attribute\Collection.php, which - in my case at least - doesn't exist.

To be exact, the file is there but it has the wrong extension - .ph instead of .php. It seems like Magento CE 1.9.0.1 was shipped like this. Maybe other releases are affected in the same way.

Magento CE 1.9.0.1 is available in 3 formats: .zip, .tar.gz, and .tar.bz2. I downloaded the .tar.gz version onto a Windows 8.1 system and extracted it using GnuWin's gzip for Windows and tar for Windows (both command-line utilities). Maybe something got corrupted because of the specific way I chose to download and extract and/or because of the OS I'm using. Or maybe this file is just misnamed at the source. Either way, renaming it to .php solved the problem for me.

Hope this helps someone - as I can see how much of a popular topic this is :oD

0
votes
If your Problem  is - magento Call to a member function setProductFilter() on a non-object in app/code/core/Mage/Catalog/Model/Product/Type/Configurable.php on line 294


Go to -
app/code/core/Mage/Catalog/Model/Resource/Product/Type/Configurable/Attribute/

And see there are the Collection.php file exist or not.
I thing there are Collection.php file exist but the file extension is not correct format.

You can change the extension only, Make it Collection.php