Disha V.
Disha V.

Reputation: 1864

Call to a member function setStore() on a non-object in magento

I have created custom shipping module and gets following error:

Fatal error: Call to a member function setStore() on a non-object in /home/devjoand/public_html/includes/src/Mage_Shipping_Model_Shipping.php on line 421

I removed all files including .xml for this shipping module and it still gives me the same error. It doesn't send me to shipping method and stops execution from savebilling controller with above error. I have cleared cache/session and recompile but nothing works. Any help would be appreciated. Thanks in advance!

NOTE: It works fine in my local machine but not working on production server.

Upvotes: 1

Views: 2351

Answers (1)

Marius
Marius

Reputation: 15216

As described partially in the comments, the error comes from this code:

    $obj = Mage::getModel($className);
    if ($storeId) {
        $obj->setStore($storeId);
    }

In the code above $obj is set to null.
You stated that your removed a shipping carrier.
I think the problem appears because you didn't deactivate first the carrier.
So in the config table the carrier appears to be enabled but there is no model associated to it so the code above fails.

In order to fix this, look in the table core_config_data for a record with this path column: carriers/CARRIER_CODE_HERE/active, where CARRIER_CODE_HERE is the code of the shipping method you just removed.

When you find the line, remove it. Actually remove everything that has a path like carriers/CARRIER_CODE_HERE/%.
be sure to backup your database first in case I'm wrong.

Upvotes: 2

Related Questions