Magento Forum

getDefaultStoreId() error after upgrade
Jr. Member
Total Posts:  24
Joined:  2008-02-20

When trying to view a product the product is replaced with the error message below.

Fatal error: Call to a member function getDefaultStoreId() on a non-object in /app/code/core/Mage/Catalog/Model/Product/Type/Price.php on line 314

Line 314 is:

$sId Mage::app()->getWebsite($wId)->getDefaultGroup()->getDefaultStoreId();

If I set $sId = 1, the products show up I thought the error might have been with getDefaultStoreId(). I traced the code back as best I could.

getDefaultStoreId() is defined in app/code/core/Mage/Catalog/Model/Resource/Eav/Mysql4/Collection/Abstract.php . The function is : 

public function getDefaultStoreId()
return Mage_Catalog_Model_Abstract::DEFAULT_STORE_ID;

DEFAULT_STORE_ID is defined on app/code/core/Mage/Catalog/Model/Abstract.php and its set as 0. If I set this value to 1 then the store doesn’t work at all.

I don’t really know php, so if anyone can help out it would be appreciated. It seems like I have always had an issue with the storeId. Whenever I upgrade through magento connect, I get an error and I have to add the following line to in order for magento connect to show back up:

Replace line 575 in app/code/core/Mage/Core/Model/App.php

$id $this->_currentStore $this->_currentStore "default";
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top