Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Adding new shipping method - fatal error
 
John72a
Jr. Member
 
Total Posts:  5
Joined:  2012-09-16
 

Hello everyone,

We desperately require some extra shipping methods for our 1.7 CE webstore. So I did some googling and found this guide: http://www.magentocommerce.com/wiki/5_-_modules_and_development/shipping/create-shipping-method-module

I followed every step quite literally, even to the point of using the names (YourCompany. NewModule etc.) used in the example.
*I have created the config.xml in app/code/local/YourCompany/NewModule/etc/
*YourCompany_NewModule.xml in app/etc/modules/
*ShippingMethod.php in app/code/local/YourCompany/NewModule/Model/Carrier/
*and system.xml in app/code/local/YourCompany/NewModule/etc/

All with the code used in the guide.

The back end works fine, however whenever I enable the new shipping method, the front end gives the following error:

Fatal error: Call to a member function setStore() on a non-object in /home/xxxx/domains/xxxx/public_html/app/code/core/Mage/Shipping/Model/Shipping.php on line 421

Line 421 is:

$obj->setStore($storeId);

In the guide there are some steps for front end problems, but even applying those fixes, make no difference and still produce the aforementioned error.

Any help is greatly appreciated, as the lack of shipping methods makes it very difficult to work.

 
Magento Community Magento Community
Magento Community
Magento Community
 
John72a
Jr. Member
 
Total Posts:  5
Joined:  2012-09-16
 

Bump, anyone? smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
Yann Ducrocq
Jr. Member
 
Total Posts:  1
Joined:  2009-04-17
 

Hi,

You may undo the corrections done in the file system.xml.

Especially the following part :

<default>
<carriers>
<mage_newmodule>
<active>1</active>
<sallowspecific>0</sallowspecific>
<model>newmodule/carrier_newmodule</model>
<name>New Module</name>
<title>New Module</title>
<specificerrmsg>
This shipping method is currently unavailable.
If you would like to ship using this shipping
method, please contact us.
</specificerrmsg>
<handling_type>F</handling_type>
</mage_newmodule>
</carriers>
</default>

 
Magento Community Magento Community
Magento Community
Magento Community
 
remi_nabf
Jr. Member
 
Total Posts:  2
Joined:  2013-02-03
 

Hello,
Did you solve the problem?
Cause I have the same. Everything was working on localhost but when I upload online, I have the following error :
Fatal error: Call to a member function setStore() on a non-object in /public_html/app/code/core/Mage/Shipping/Model/Shipping.php on line 421
I tried the fixes without solving it.
Any fresh ideas?
Cheers

 
Magento Community Magento Community
Magento Community
Magento Community
 
remi_nabf
Jr. Member
 
Total Posts:  2
Joined:  2013-02-03
 

It works now.
Considering the structure :

local
       MyCompany
                 MyModule
                           etc
                                    config
.xml
                                    system
.xml
                           Model
                                      MyMethode
.php

I changed the name of my shipping methods in the following files (example thenewmethodname)

- Local / MyCompany / MyModule / etc / config.xml

<default>  
        <
carriers>    
            <
thenewmethodname>
                <
active>1</active>
                <
sallowspecific>0</sallowspecific>
                <
model>shippingmodule/carrier_thenewmethodname</model>
                <
name>Pickup custom</name>
                <
type>I</type>
                <
specificerrmsg>This shipping method is currently unavailable. If you would like to ship using this shipping methodplease contact us.</specificerrmsg>
                <
handling_type>F</handling_type>
            </
thenewmethodname>
        </
carriers>
    </default>
- Local / MyCompany / MyModule / etc/system.xml
<?xml version="1.0"?>
<config>
    <
sections>
        <
carriers>
            <
groups>
                <
thenewmethodname translate="label" module="shipping">
                               ......................
                </
thenewmethodname>
................
/ Local / MyCompany / MyModule / Model/Thenewmethodname.php

class MyCompany_MyModule_Model_Carrier_Thenewmethodname extends Mage_Shipping_Model_Carrier_Abstract
{
    
/**
     * unique internal shipping method identifier
     *
     * @var string [a-z0-9_]
     */
    
protected $_code 'thenewmethodname';
...................

and clean the cache.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top