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

Removing Custom Shipping Module leaves shipping broken
 
jyarrington
Jr. Member
 
Total Posts:  9
Joined:  2008-07-22
 

I added a custom shipping module following the instructions in http://www.magentocommerce.com/wiki/how-to/create-shipping-method-module

However, when removing the shipping module, I am left with a information about the carrier in core_config_data.  Also, the core shipping code tries to load this removed shipping module too.

# Output from /var/report

#0 /srv/www/htdocs/app/code/core/Mage/Core/functions.php(67): mageCoreErrorHandler(2, 'include(Mage/Va...', '/srv/www/htdocs...', 67, Array)
#1 /srv/www/htdocs/app/code/core/Mage/Core/functions.php(67): __autoload()
#2 [internal function]: __autoload('Mage_Variablesh...')
#3 /srv/www/htdocs/app/code/core/Mage/Core/Model/Config.php(714): class_exists('Mage_Variablesh...')
#4 /srv/www/htdocs/app/Mage.php(287): Mage_Core_Model_Config->getModelInstance('variableshippin...', Array)
#5 /srv/www/htdocs/app/code/core/Mage/Shipping/Model/Shipping.php(169): Mage::getModel('variableshippin...')
#6 /srv/www/htdocs/app/code/core/Mage/Shipping/Model/Shipping.php(121): Mage_Shipping_Model_Shipping->getCarrierByCode('carrier_name', '1')
#7 /srv/www/htdocs/app/code/core/Mage/Shipping/Model/Shipping.php(101): Mage_Shipping_Model_Shipping->collectCarrierRates('carrier_name', Object(Mage_Shipping_Model_Rate_Request))
#8 /srv/www/htdocs/app/code/core/Mage/Sales/Model/Quote/Address.php(516): Mage_Shipping_Model_Shipping->collectRates(Object(Mage_Shipping_Model_Rate_Request))
#9 /srv/www/htdocs/app/code/core/Mage/Sales/Model/Quote/Address/Total/Shipping.php(132): Mage_Sales_Model_Quote_Address->collectShippingRates()
#10 /srv/www/htdocs/app/code/core/Mage/Sales/Model/Quote/Address.php(569): Mage_Sales_Model_Quote_Address_Total_Shipping->collect(Object(Mage_Sales_Model_Quote_Address))
#11 /srv/www/htdocs/app/code/core/Mage/Sales/Model/Quote.php(835): Mage_Sales_Model_Quote_Address->collectTotals()
#12 /srv/www/htdocs/app/code/core/Mage/Checkout/Model/Type/Onepage.php(238): Mage_Sales_Model_Quote->collectTotals()
#13 /srv/www/htdocs/app/code/core/Mage/Checkout/controllers/OnepageController.php(254): Mage_Checkout_Model_Type_Onepage->saveShipping(Array, '1')
#14 /srv/www/htdocs/app/code/core/Mage/Core/Controller/Varien/Action.php(343): Mage_Checkout_OnepageController->saveShippingAction()
#15 /srv/www/htdocs/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(144): Mage_Core_Controller_Varien_Action->dispatch('saveShipping')
#16 /srv/www/htdocs/app/code/core/Mage/Core/Controller/Varien/Front.php(168): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#17 /srv/www/htdocs/app/Mage.php(420): Mage_Core_Controller_Varien_Front->dispatch()
#18 /srv/www/htdocs/index.php(46): Mage::run()
#19 {main}";}

I have tried clearing the cache through the admin interface, as well as deleting everything in var/session and var/cache.  However, the core shipping code is still not working because it is looking for this shipping module which no longer exists.

What other remnants could be left of the custom shipping module?

 
Magento Community Magento Community
Magento Community
Magento Community
 
LeeSaferite
Guru
 
Avatar
Total Posts:  322
Joined:  2007-08-31
Lake City, FL
 

Well, if you followed the instructions about adding

<model translate="label">
  <
label>Model</label>
  <
frontend_type>text</frontend_type>
  <
sort_order>900</sort_order>
  <
show_in_default>1</show_in_default>
  <
show_in_website>1</show_in_website>
</
model>

Then Mage_Shipping_Model_Shipping::getCarrierCode() is getting your old model from the store config and trying to load it.  Since you have removed the model class, it fails with the error message you are getting.  If you remove the config entry for your custom shipping module, you should go back to normal.

This SQL should help you find the offending config data

SELECT FROM magento.core_config_data WHERE path "carriers/carrier_name/model";
or
SELECT FROM magento.core_config_data WHERE scope "default" AND scope_id AND path "carriers/carrier_name/model";
or
SELECT FROM magento.core_config_data WHERE scope "stores" AND scope_id AND path "carriers/carrier_name/model";

You should probably clear your caches after removing it, just to be safe.

 
Magento Community Magento Community
Magento Community
Magento Community
 
jyarrington
Jr. Member
 
Total Posts:  9
Joined:  2008-07-22
 

Thanks, I looked into that and cleared out all the core_config_data entries where path like ‘&#xca;rrier_name%’.  You can see the results of what is in core_config_data for carriers.  For some reason, carrier_name still shows up in my collection of carriers when walking through the code. 

mysqlselect scopepath from core_config_data where path like '&#xca;rriers%' order by path;
+----------+----------------------------------------------+
scope    path                                         |
+----------+----------------------------------------------+
| default  | 
carriers/dhl/account                         |
| default  | 
carriers/dhl/active                          |
| default  | 
carriers/dhl/allowed_methods                 |
| default  | 
carriers/dhl/contentdesc                     |
| default  | 
carriers/dhl/dutiable                        |
| default  | 
carriers/dhl/dutypaymenttype                 |
| default  | 
carriers/dhl/free_method                     |
| default  | 
carriers/dhl/free_shipping_enable            |
| default  | 
carriers/dhl/free_shipping_subtotal          |
| default  | 
carriers/dhl/gateway_url                     |
| default  | 
carriers/dhl/handling_action                 |
| default  | 
carriers/dhl/handling_fee                    |
| default  | 
carriers/dhl/handling_type                   |
| default  | 
carriers/dhl/id                              |
| default  | 
carriers/dhl/max_package_weight              |
| default  | 
carriers/dhl/password                        |
| default  | 
carriers/dhl/sallowspecific                  |
| default  | 
carriers/dhl/shipment_type                   |
| default  | 
carriers/dhl/shipping_intlkey                |
| default  | 
carriers/dhl/shipping_key                    |
| default  | 
carriers/dhl/showmethod                      |
| default  | 
carriers/dhl/sort_order                      |
| default  | 
carriers/dhl/specificerrmsg                  |
| default  | 
carriers/dhl/title                           |
| default  | 
carriers/fedex/account                       |
| default  | 
carriers/fedex/active                        |
| default  | 
carriers/fedex/allowed_methods               |
| default  | 
carriers/fedex/dropoff                       |
| default  | 
carriers/fedex/free_method                   |
| default  | 
carriers/fedex/free_shipping_enable          |
| default  | 
carriers/fedex/free_shipping_subtotal        |
| default  | 
carriers/fedex/gateway_url                   |
| default  | 
carriers/fedex/handling_action               |
| default  | 
carriers/fedex/handling_fee                  |
| default  | 
carriers/fedex/handling_type                 |
| default  | 
carriers/fedex/max_package_weight            |
| default  | 
carriers/fedex/packaging                     |
| default  | 
carriers/fedex/residence_delivery            |
| default  | 
carriers/fedex/sallowspecific                |
| default  | 
carriers/fedex/showmethod                    |
| default  | 
carriers/fedex/sort_order                    |
| default  | 
carriers/fedex/specificerrmsg                |
| default  | 
carriers/fedex/title                         |
| default  | 
carriers/flatrate/active                     |
| default  | 
carriers/flatrate/handling_fee               |
| default  | 
carriers/flatrate/handling_type              |
| default  | 
carriers/flatrate/name                       |
| default  | 
carriers/flatrate/price                      |
| default  | 
carriers/flatrate/sallowspecific             |
| default  | 
carriers/flatrate/showmethod                 |
| default  | 
carriers/flatrate/sort_order                 |
| default  | 
carriers/flatrate/specificcountry            |
| default  | 
carriers/flatrate/specificerrmsg             |
| default  | 
carriers/flatrate/title                      |
| default  | 
carriers/flatrate/type                       |
| default  | 
carriers/freeshipping/active                 |
| default  | 
carriers/freeshipping/free_shipping_subtotal |
| default  | 
carriers/freeshipping/name                   |
| default  | 
carriers/freeshipping/sallowspecific         |
| default  | 
carriers/freeshipping/showmethod             |
| default  | 
carriers/freeshipping/sort_order             |
| default  | 
carriers/freeshipping/specificerrmsg         |
| default  | 
carriers/freeshipping/title                  |
| default  | 
carriers/tablerate/active                    |
| default  | 
carriers/tablerate/condition_name            |
| default  | 
carriers/tablerate/handling_fee              |
| default  | 
carriers/tablerate/handling_type             |
websites carriers/tablerate/import                    |
| default  | 
carriers/tablerate/name                      |
| default  | 
carriers/tablerate/sallowspecific            |
| default  | 
carriers/tablerate/showmethod                |
| default  | 
carriers/tablerate/sort_order                |
| default  | 
carriers/tablerate/specificcountry           |
| default  | 
carriers/tablerate/specificerrmsg            |
| default  | 
carriers/tablerate/title                     |
| default  | 
carriers/ups/access_license_number           |
| default  | 
carriers/ups/active                          |
| default  | 
carriers/ups/allowed_methods                 |
| default  | 
carriers/ups/container                       |
| default  | 
carriers/ups/dest_type                       |
| default  | 
carriers/ups/free_method                     |
| default  | 
carriers/ups/free_shipping_enable            |
| default  | 
carriers/ups/free_shipping_subtotal          |
| default  | 
carriers/ups/gateway_url                     |
| default  | 
carriers/ups/gateway_xml_url                 |
 
Magento Community Magento Community
Magento Community
Magento Community
 
LeeSaferite
Guru
 
Avatar
Total Posts:  322
Joined:  2007-08-31
Lake City, FL
 

Could you elaborate on what you mean by

For some reason, carrier_name still shows up in my collection of carriers when walking through the code.

Where are you still seeing carrier_name?  (possibly in a placed order?)

 
Magento Community Magento Community
Magento Community
Magento Community
 
jyarrington
Jr. Member
 
Total Posts:  9
Joined:  2008-07-22
 

Yes, no problem.  In line 98 of /app/code/core/Mage/Shipping/Model/Shipping.php in the collectRates function.  When examinging the collection $carriers, the added carrier “carrier_name” still appears as a member of this collection.

Thanks for you feedback.  This has me stumped.  I figure I am probably just missing it cached somewhere or some remnant in the db.  I have tried to step into this method, but am getting confused about when/where it is loading the shipping methods.

79     /**
 80      * Retrieve all methods for supplied shipping data
 81      *
 82      * @todo make it ordered
 83      * @param Mage_Shipping_Model_Shipping_Method_Request $data
 84      * @return Mage_Shipping_Model_Shipping
 85      */
 
86     public function collectRates(Mage_Shipping_Model_Rate_Request $request)
 
87     {
 88         
if (!$request->getOrig()) {
 89             $request
 90                 
->setCountryId(Mage::getStoreConfig('shipping/origin/country_id'$request->getStore()))
 
91                 ->setRegionId(Mage::getStoreConfig('shipping/origin/region_id'$request->getStore()))
 
92                 ->setCity(Mage::getStoreConfig('shipping/origin/city'$request->getStore()))
 
93                 ->setPostcode(Mage::getStoreConfig('shipping/origin/postcode'$request->getStore()));
 
94         }
 95
 96         $limitCarrier 
$request->getLimitCarrier();
 
97         if (!$limitCarrier{
 98             $carriers 
Mage::getStoreConfig('carriers'$request->getStoreId());
 
99
100             
foreach ($carriers as $carrierCode=>$carrierConfig{
101                 $this
->collectCarrierRates($carrierCode$request);
102             }
103         } 
else {
104             
if (!is_array($limitCarrier)) {
105                 $limitCarrier 
= array($limitCarrier);
106             }
107             
foreach ($limitCarrier as $carrierCode{
108                 $carrierConfig 
Mage::getStoreConfig('carriers/'.$carrierCode$request->getStoreId());
109                 if (!$carrierConfig{
110                     
continue;
111                 }
112                 $this
->collectCarrierRates($carrierCode$request);
113             }
114         }
115
116         
return $this;
117     }
 
Magento Community Magento Community
Magento Community
Magento Community
 
LeeSaferite
Guru
 
Avatar
Total Posts:  322
Joined:  2007-08-31
Lake City, FL
 

Ok, it seems like it must be a caching issue somewhere since you removed all the carriers/carrier_name entries from your DB.

If you have tried clearing the cache inside magento and that didn’t work, try this.

Shut down the web server, delete the contents of the /var/cache directory that is under your root magento directory, and restart your server.

That is brute force, but it may help.  Assuming you really did remove ALL entries of ‘carriers/carrier_name’

 
Magento Community Magento Community
Magento Community
Magento Community
 
jyarrington
Jr. Member
 
Total Posts:  9
Joined:  2008-07-22
 

That cleared out the reference.  I must have been clearing the cache without restarting the web server and somehow it was still hanging around? 

I am now getting the flat rate to calculate, but am still hung at the OnePage checkout.  But, this gets me over a hurdle and will dig further.  Thanks for the help.

Jason

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