Hi everyone!
I'm having trouble getting a custom shipping module to work. I've followed several tutorials, but each time I get an error:
Fatal error: Call to a member function setStore() on a non-object in /home/tigersoh/tiger-soho.com.ua/mag/includes/src/Mage_Shipping_Model_Shipping.php on line 424
My code:
app/etc/modules/Fashion_Delivery.xml
<?xml version="1.0"?> <config> <modules> <Fashion_Delivery> <active>true</active> <codePool>local</codePool> <depends> <Mage_Shipping /> </depends> </Fashion_Delivery> </modules> </config>
/app/code/local/Fashion/Delivery/etc/config.xml
<?xml version="1.0" encoding="UTF-8"?> <config> <modules> <Fashion_Delivery> <module>0.0.1</module> </Fashion_Delivery> </modules> <global> <models> <services> <class>Fashion_Delivery_Model</class> </services> </models> </global> <default> <carriers> <services> <active>1</active> <model>fashion_delivery/services</model> <title>Delivery Services</title> <sort_order>10</sort_order> <price>5.00</price> <sallowspecific>0</sallowspecific> </services> </carriers> </default> </config>
/app/code/local/Fashion/Delivery/etc/system.xml
<?xml version="1.0" encoding="UTF-8"?> <config> <sections> <carriers> <groups> <services translate="label" module="ship"> <label>Delivery Services</label> <frontend_type>text</frontend_type> <sort_order>99</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> <show_in_store>1</show_in_store> <fields> <active translate="label"> <label>Enabled</label> <frontend_type>select</frontend_type> <source_model>adminhtml/system_config_source_yesno</source_model> <sort_order>1</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> <show_in_store>1</show_in_store> </active> <title translate="label"> <label>Title</label> <frontend_type>text</frontend_type> <sort_order>2</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> <show_in_store>1</show_in_store> </title> <name translate="label"> <label>Method Name</label> <frontend_type>text</frontend_type> <sort_order>2</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> <show_in_store>1</show_in_store> </name> <price translate="label"> <label>Price</label> <frontend_type>text</frontend_type> <sort_order>3</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> <show_in_store>0</show_in_store> </price> <specificerrmsg translate="label"> <label>Displayed Error Message</label> <frontend_type>textarea</frontend_type> <sort_order>4</sort_order> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> <show_in_store>1</show_in_store> </specificerrmsg> <sallowspecific translate="label"> <label>Ship to Applicable Countries</label> <frontend_type>select</frontend_type> <sort_order>90</sort_order> <frontend_class>shipping-applicable-country</frontend_class> <source_model>adminhtml/system_config_source_shipping_allspecificcountries</source_model> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> <show_in_store>0</show_in_store> </sallowspecific> <specificcountry translate="label"> <label>Ship to Specific Countries</label> <frontend_type>multiselect</frontend_type> <sort_order>91</sort_order> <source_model>adminhtml/system_config_source_country</source_model> <show_in_default>1</show_in_default> <show_in_website>1</show_in_website> <show_in_store>0</show_in_store> <can_be_empty>1</can_be_empty> </specificcountry> </fields> </services> </groups> </carriers> </sections> </config>
/app/code/local/Fashion/Delivery/Model/Carrier/Services.php
<?php class Fashion_Delivery_Model_Carrier_Services extends Mage_Shipping_Model_Carrier_Abstract implements Mage_Shipping_Model_Carrier_Interface { protected $_code = 'services'; public function collectRates( Mage_Shipping_Model_Rate_Request $request ) { $result = Mage::getModel('shipping/rate_result'); $result->append($this->_getStandardShippingRate()); return $result; } protected function _getStandardShippingRate() { $rate = Mage::getModel('shipping/rate_result_method'); $rate->setCarrier($this->_code); $rate->setCarrierTitle($this->getConfigData('title')); $rate->setMethod('standand'); $rate->setMethodTitle('Standard'); //$rate->setPrice(5.00); $rate->setCost(0); return $rate; } public function getAllowedMethods() { return array( 'standard' => 'Standard', ); } }
Can someone tell what could be the problem?
turn off cache and compiler while developing
Please turn off the compiler and if you like to turn on the compiler then please run the compilation process once.
Compiler was turned off.
I've just tried to rewrite module and run the compilation progress. Error has gone, but custom shipping method is not showing.
Update: The error appears now on cart page only.
Please check if the Shipping Method is enabled from the admin side and share the screenshot if there is any error you are having.
Shipping method is enabled:
When I open the cart:
On checkout page method is not showing: