Author Topic: More on Royal Mail shipping Extension  (Read 1621 times)

Offline featurespoon

  • Newbie
  • *
  • Posts: 10
  • Karma: +2/-0
    • View Profile
More on Royal Mail shipping Extension
« on: November 29, 2016, 07:30:08 AM »
As in earlier posts I am having great difficulty in getting the Royal Mail shipping extension to show in the cart. I am using version 1.2.8. I have read the earlier posts and replies and still can't get this extension to appear against shipments in the cart. Extension options chosen:
default store
status on
Second Class Standard Post
Standard Parcels
airmail
tax class zero rated
all locations
auto select off
accept these payments: blank
run order 1

 I have set the weight units to kilograms in both the extension and the product in the cart.   My location is the UK and my customers are in the UK.

This is not how Royal Mail charges now, and I'm intending to attempt to rewrite the extension myself using dimension data, but it should be possible to
bring up the shipping extension as it is, and I can't. Can you tell me what I'm failing to do?
Thanks

Offline featurespoon

  • Newbie
  • *
  • Posts: 10
  • Karma: +2/-0
    • View Profile
Re: More on Royal Mail shipping Extension
« Reply #1 on: December 01, 2016, 09:00:57 AM »
Well, I've been able to solve this myself. I hope the below helps others.

I've discovered that the extension was invoked, but failed to show anything on the shipment drop-down on the cart page for two reasons:

- no location zones had been set up for the location (country) which was selected in the Shipping Extension admin page
- the cost was calculated (correctly or incorrectly) to be zero.

The xx_zones_to_locations table only had entries for the USA, whereas UK entries were essential given that this is a UK-only service, the Royal Mail.  I don't know if I had installed Abantecart correctly, but by tinkering directly with the database, I have added 100 entries for UK locations to this table. 

I think you can achieve the same result without knowing any SQL by selecting System -> Localization -> Locations. Make sure the country is there, click on the Edit symbol and choose Location Zones. If no zones for this country are shown, click on the plus top left.  Select the required country, select all and save. The zones will be added to the 'location'.

I have to say that this ability to choose 'zones' within countries is a very good facility of Abantecart. Without it, getting the charges right for shipping to remote locations would not be possible.

However, this was not enough to bring up the shipping in the shipment drop-down.

In addition to this, references in the code to weight units were incorrect, the string literals should end in ..._class not ..._class_id.  This meant that weights in grams were not converted to kilograms, so the code tried to find a charge for a weight of hundreds of kilograms! No surprisingly this failed, the maximum weight being 1 kilogram, and so a cost of zero was 'calculated'.  When the weight classes were corrected, the shipping offer appeared in the shipment drop-down.  Success.

I attach the corrected php file.
« Last Edit: December 01, 2016, 12:50:44 PM by featurespoon »

Offline Basara

  • Administrator
  • Hero Member
  • *****
  • Posts: 3825
  • Karma: +185/-0
    • View Profile
Re: More on Royal Mail shipping Extension
« Reply #2 on: December 02, 2016, 05:46:34 AM »
Hello.

Please try to avoid direct database edit.
In AbanteCart you can create/modify Locations as well Countries with Zones in admin panel

http://docs.abantecart.com/pages/localization/index.html
« Last Edit: December 02, 2016, 05:49:20 AM by Basara »
“Chuck Norris is so amazing.”
― Mother Teresa

Offline Basara

  • Administrator
  • Hero Member
  • *****
  • Posts: 3825
  • Karma: +185/-0
    • View Profile
Re: More on Royal Mail shipping Extension
« Reply #3 on: December 02, 2016, 06:33:58 AM »
Thank you featurespoon for posting your solution
“Chuck Norris is so amazing.”
― Mother Teresa