Search code examples
phpsilverstripesilverstripe-4silvershop

SilverStripe SilverShop Shipping - Disabling distance shipping method


I've set up an ecommerce site using the SilverShop add-on which utilises SilverStripe Shipping.

Whenever I try to run this on a remote server (such as the production copy of the site), I get an error related to silvershop/geocoding, which is a requirement of the silvershop/shipping library for the DistanceShippingMethod feature.

The error is as follows:

[Emergency] Uncaught Error: Call to undefined method Geocoder\Model\AddressCollection::toArray()

GET /

Line 43 in ...\vendor\silvershop\geocoding\src\Extensions\GeocodedUserInfo.php

This error doesn't appear on localhost as the $ip variable is null, so line 43 is skipped. It's only when you're connecting using an external IP does the error appear.

I've tried disabling this extension to get around the issue by using remove_extension in both _config.php and mysite.yml, but with no joy. I've also used the config suggested by silvershop/geocoding:

SilverShop\Model\Address:
  enable_geocoding: false

But this doesn't stop that particular line being run, so doesn't resolve the issue.

So, my next step would be to disable the DistanceShippingMethod completely, as it's not used by this site anyway. But I can't see how to do this.

Any pointers on how to either fix the initial error, or how to disable that specific feature, would be very much welcome!


Solution

  • This issue has now been fixed on the SilverShop Geocoding module GitHub repository: https://github.com/silvershop/silvershop-geocoding/commit/c225ae7369f81098bfb38c0e8b3f9160ffacdfcf

    Update the module, deploy that fix and this issue should be resolved.