Error While Creating Custom Shipping Method in Magento

customshippingshipping-methods

I am creating Custom Shipping Method in Magento.i had refered Inchoo, Excellence blog and even other blogs but everytime i get this error

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

Please Help Me.

Best Answer

Most probably the model that should handle the shipping method is not found.
Either it does not exist, or it is wrongly configured.

Make sure you have in your config.xml the model for the shipping method.
In the example you used it's

<model>shipping/carrier_inchoocustom</model>

This means that the model used will be Mage_Shipping_Model_Carrier_Inchoocustom. Make sure that exists also.

You can easily test with this code...

echo get_class(Mage::getModel('shipping/carrier_inchoocustom'));

Put that in any page of your code.

If that renders nothing it means the class Mage_Shipping_Model_Carrier_Inchoocustom is not found. Either it does not exist or it is placed in the wrong file/folder.

if it outputs Mage_Shipping_Model_Carrier_Inchoocustom it means you are missing the <model> declaration in config.xml.

And on a side note, with all respect for Inchoo and the great work they are doing in their example something is wrong. Even if it works, the Mage folder should not be used for custom extensions.

You can also check this for an other tutorial on how to create a shipping method: www.magentocommerce.com/wiki/5_-_modules_and_development/shipping/create-shipping-method-module

Related Topic