Reputation: 11
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?
Upvotes: 1
Views: 974
Reputation: 2138
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
Upvotes: 0
Reputation: 1309
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:
$this->getProduct($product)
Mage::getResourceModel('catalog/product_type_configurable_attribute_collection')
setProductFilter
method, passing in
the product objectIt'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
Upvotes: 0