Post by marcemarc » Sat Apr 28, 2012 5:43 am

April 2012 - Royal mail have changed their pricing structure for Airmail, there used to be just:
Europe and Rest of World,
there is now: Europe, WorldZone1 and WorldZone2:
see here: http://www.royalmail.com/sites/default/ ... il2012.pdf
WorldZone1 is defined as being all the countries not in europe and not in worldzone2, worldzone2 are a name list of 15 or so countries / islands, that notably include Australia and New Zealand.

This messes up standard OpenCart Royal Mail Extension because it only has two places to set the prices per weights, once for europe and once for the rest of the world.

Not sure how anyone else is handling this ? or whether I've missed an extension update somewhere, but since the prices change at the end of month, and we ship alot to Australia, I've found myself adding a hack into the /catalog/model/shipping/royal_mail.php file.

The hack defines the worldzone2 countries, and add a check to see if ship to country is one of those, if so then opencart doesn't use the configured rates in the admin instead it uses a set of hardcoded rates for the worldzone2 countries. Short term but I guess it won't change till next April ?

I have changed the following lines

Code: Select all

// Airmail
			if ($this->config->get('royal_mail_airmail_status')&& $address['iso_code_2'] != 'GB') {
				$cost = 0;
				
				$countries = explode(',', 'AL,AD,AM,AT,AZ,BY,BE,BA,BG,HR,CY,CZ,DK,EE,FO,FI,FR,GE,DE,GI,GR,GL,HU,IS,IE,IT,KZ,KG,LV,LI,LT,LU,MK,MT,MD,MC,NL,NO,PL,PT,RO,RU,SM,SK,SI,ES,SE,CH,TJ,TR,TM,UA,UZ,VA');
				
				if (in_array($address['iso_code_2'], $countries)) {
					$rates = explode(',', $this->config->get('royal_mail_airmail_rate_1'));
				} else {
					$rates = explode(',', $this->config->get('royal_mail_airmail_rate_2'));
Into:

Code: Select all

	// Airmail
			if ($this->config->get('royal_mail_airmail_status')&& $address['iso_code_2'] != 'GB') {
				$cost = 0;
				
				$countries = explode(',', 'AL,AD,AM,AT,AZ,BY,BE,BA,BG,HR,CY,CZ,DK,EE,FO,FI,FR,GE,DE,GI,GR,GL,HU,IS,IE,IT,KZ,KG,LV,LI,LT,LU,MK,MT,MD,MC,NL,NO,PL,PT,RO,RU,SM,SK,SI,ES,SE,CH,TJ,TR,TM,UA,UZ,VA');

$worldzone2 = explode(',','AU,CX,FJ,KI,NZ,AQ,SG,TO,CC,PF,MO,PG,SB,TV,IO,CK,NR,NU,LA,AS,NC,NF,PN,TK,WS');
				
				if (in_array($address['iso_code_2'], $countries)) {
					$rates = explode(',', $this->config->get('royal_mail_airmail_rate_1'));
				} else {
					if (in_array($address['iso_code_2'], $worldzone2)) {
						$rates = explode(',', '100:3.30,150:3.90,200:4.50,250:5.10,300:5.70,400:6.98,500:8.26,600:9.54,700:10.82,800:12.10,900:13.38,1000:14.66,1100:15.94,1200:17.22,1300:18.50,1400:19.78,1500:21.06,1600:22.34,1700:23.62,1800:24.90,1900:26.18,2000:27.46');
					} else {
						$rates = explode(',', $this->config->get('royal_mail_airmail_rate_2'));
					}
				}
WorldZone1 rates and Europe rates would need to be updated via the admin!

I don't know if that's of help to anyone, or if someone can point me in direction of a better way, presuming need a way of creating a $this->config->get('royal_mail_airmail_rate_3') that becomes editable in the admin.

Newbie

Posts

Joined
Tue Apr 10, 2012 8:53 am

Post by L146705 » Sat May 05, 2012 8:10 pm

Thanks going to try this out. I posted some of the updated price strings here http://forum.opencart.com/viewtopic.php?f=114&t=61837

New member

Posts

Joined
Sun Feb 26, 2012 2:50 am

Post by L146705 » Sun May 06, 2012 4:44 am

Thanks edited the code to get it working for international signed for. I've also done a lot of the strings prices/strings required for the royal mail extension. Hope this helps:
http://forum.opencart.com/viewtopic.php ... 77#p284377

New member

Posts

Joined
Sun Feb 26, 2012 2:50 am

Post by marcemarc » Mon Apr 01, 2013 9:54 pm

And for 2013, this is the revised 'price string' for the above 'hack' for updating Royal Mail World Zone 2 prices:

Code: Select all

 $rates = explode(',', '100:3.65,250:4.85,500:7.75,750:10.60,1000:13.45,1250:16.30,1500:19.25,1750:22.00,2000:24.95');
in case it's useful to anyone.

Newbie

Posts

Joined
Tue Apr 10, 2012 8:53 am

Post by timparnell » Sat Aug 24, 2013 5:27 am

Fantastic help. You just saved my store....

I work with shipping set to Kilos so the following is the string you need if that is the case...

Code: Select all

 $rates = explode(',', '.1:3.50,.25:4.70,.5:7.55,.750:10.40,1:13.25,1.250:16.10,1.500:18.95,1.750:21.80,2.000:24.65');
for grams

Code: Select all

 $rates = explode(',', '100:3.50,250:4.70,500:7.55,750:10.40,1000:13.25,1250:16.10,1500:18.95,1750:21.80,2000:24.65');
I also changed the money to reflect the current (Aug 2013) RM price list.

Hope this helps
Tim

tim@pointreddesign.co.uk | http://www.pointreddesign.co.uk


User avatar
New member

Posts

Joined
Wed Feb 01, 2012 11:03 pm
Location - Norwich, Norfolk, UK
Who is online

Users browsing this forum: No registered users and 0 guests