Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[CONTRIB] UK Royal Mail & Overseas Shipping Methods


Guest

Recommended Posts

This contribution is for UK Stores ONLY. What it will do is add several shipping zones to your Oscommerce store. If your customer is UK based, it will not show any of the International Shipping Options, and vice versa, if your customer is International it will not show any UK based shipping methods.

 

Shipping Methods Added:

 

(1) Royal Mail First Class Standard Post (upto 3.0Kg Limit anymore and a courier is recommended)

(2) Royal Mail Second Class Standard Post (upto 1.0Kg Limit)

(3) Royal Mail First Class Recorded Post (upto 3.0Kg and ?32.00 Limit)

(4) Royal Mail Second Class Recorded Post (upto 1.0Kg and ?32.00 Limit)

(5) Royal Mail Standard Parcels (upto 20.0Kg and ?500) with additional insurance

(6) Parcel Force 48 (>3Kg Limit, any less Royal Mail is recommended)

(7) Citylink Next Day (>3Kg Limit, any less Royal Mail is recommended)

 

(8) Royal Mail International Signed for (European Prices for weights upto 2Kg)

(9) Royal Mail International Signed for (Zone 1 for weights upto 2Kg)

(10) Royal Mail International Signed for (Zone 2 for weights upto 2Kg)

 

 

INFORMATION

===========

 

All Royal Mails prices are for the new style (packets) pricing as of 21st August 2006, however common sense is needed, a 3.0Kg parcel sent by Royal Mail First class standard delivery would cost ?10.69 using the new shipping prices, therefore it would make sense to post it by Royal Mail Standard Parcels, therefore we have placed limits on the lower end shipping methods. If a product goes over this limit, the shipping option will not be displayed.

 

IMPORTANT NOTES IMPORTANT NOTES IMPORTANT NOTES IMPORTANT NOTES IMPORTANT NOTES

=================================================================

 

IF YOU DECIDE TO INSTALL ONLY THE ROYAL MAIL MODULES AND NOT ANY OF THE COURIERS OR PARCEL FORCE MODULES, PLEASE OPEN THE ROYAL MAIL MODULES AND REMOVE THE LIMITS.

If you do not remove the limits and you have no other shipping modules installed, if someone buys something from you over ?32.00, there will be no shipping option shown, hence your customer can checkout and pay ?0.00 shipping.

 

To summarise, either install Royal Mail modules with a courier (Standard Parcels, Citylink or Parcelforce) or if you install the Royal Mail modules on their own, (RM 1st, RM 2nd, RM 1st REC or RM 2nd REC) edit the files to remove the limits.

 

 

INSTALLATION

==========

Only one file needs a change, for cosmetic reasons.

 

 

Step (1) Open catalog/checkout_shipping.php

-------------------------------------------

In checkout_confirmation, double brackets are shown and not required, so the below edit removes this.

 

[Find around Line 121 in catalog/checkout_shipping.php]

 

'title' => (($free_shipping == true) ? $quote[0]['methods'][0]['title'] : $quote[0]['module'] . ' (' . $quote[0]['methods'][0]['title'] . ')'),

 

[CHANGE TO]

 

'title' => (($free_shipping == true) ? $quote[0]['methods'][0]['title'] : $quote[0]['module'] . $quote[0]['methods'][0]['title']),

 

 

Step (2) Upload Shipping Modules

---------------------------------------

Each Shipping method has 3 files each, decide which shipping methods you want to install and upload the shipping file located in catalog/includes/modules/shipping/ and also its corresponding langauage file located in catalog/includes/languages/english/modules/shipping/ also included is an image icon, upload this into your images directory. Now goto your OSC admin panel modules-->shipping and adjust anything to suit your needs.

 

NOTES

=====

The prices in these contribs are shown inc of VAT at 17.5%, each module has a handling charge for example if you want to charge for jiffy bags, labels invoice paper etc.

 

PRICES

======

The scripts are automatically loaded with the prices located from Royal Mails and Parcel Forces website, these values can be seen below. I am fully aware, that these prices will vary depending if you have SmartStamp or PPI accounts with Royal Mail etc. If your prices are different just update whichever string below, and copy it into the contribution via your OSC admin panel/modules/shipping.

 

The strings shown below are defined as follows for weights in KG's (If you require grammes adjust accordingly, 0.1Kg = 100g etc)

 

.1:1,.25:1.27,.5:1.7

 

What this means, is that for all items under 0.1Kg (100g) the cost of delivery is ?1.00, then for all items more than 0.1Kg but less than 0.25Kg the price of shipping is ?1.27. Notice there are no spaces and each price division is separated by a comma.

 

Royal Mail First Class Standard (Packet Prices):

.1:1,.25:1.27,.5:1.7,.75:2.2,1:2.7,1.25:4.74,1.5:5.59,1.75:6.44,2:7.29,2.25:8.14

,2.5:8.99,2.75:9.84,3:10.69

 

Royal Mail Second Class Standard (Packet Prices):

.1:.84,.25:1.09,.5:1.39,.75:1.77,1:2.12

 

Royal Mail First Class Recorded (Packet Prices):

.1:1.68,.25:1.95,.5:2.38,.75:2.88,1:3.38,1.25:5.42,1.5:6.27,1.75:7.12,2:7.97,2.2

5:8.82,2.5:9.67,2.75:10.52,3:11.37

 

Royal Mail Second Class Recorded (Packet Prices):

.1:1.52,.25:1.77,.5:2.07,.75:2.45,1:2.8

 

Royal Mail Standard Parcels:

1:3.85,1.5:4.95,2:5.31,4:7.7,6:8.74,8:9.97,10:10.7,20:12.46

 

Royal Mail Special Delivery:

Royal Mail has 3 levels of special delivery depending on cost of items, these being upto ?500, ?1000 or ?2500. The three lists can be seen below, the module uses the last one of ?2500, change as neccessary via your admin panel, just copy and paste.

 

.1:4.1,.5:4.5,1:5.7,2:7.4,10:18.5

.1:4.6,.5:5,1:6.2,2:7.9,10:19

.1:5.6,.5:6,1:7.2,2:8.9,10:20

 

Initial CityLink Nextday: (Amend prices to suit your account if applicable)

Taken from http://www.initialcitylink.co.uk/services/...ces_pricing.php where 10Kg is ?11.60 then ?0.50 per Kg afterwards

10:11.6,15:14.1,20:16.60,25:19.1,30:21.6,35:24.1,40:26.6,45:29.1,50:31.6,55:34.1

,60:36.6,65:39.1,70:41.6,75:44.1,80:46.6,100:56.6,125:69.1,150:81.6,200:106.6

 

Parcel Force 48:

10:14.25,15:18.25,20:22.25,25:26.25,30:30.25,40:38.25,50:46.25,100:86.50

 

SUPPORT

=======

 

To keep this contribution clean, can I ask any other mod writters, if they find any

problems to post back in the forum and if applicable I will add these changes to the

next update. By doing it this way, other users will not be confused on which version

to download etc.

 

Thank you.

Link to comment
Share on other sites

"If your customer is UK based, it will not show any of the International Shipping Options, and vice versa, if your customer is International it will not show any UK based shipping methods."

 

Hi, really intrested in this thanks for taking the time but can I have what seems a simple question about the above statement.

 

If I am a gift buyer in one country, say USA, will I be able to buy an item and have it delivered to another country address, UK, or visa versa. From what you say above I wouldn't be able to see the P&P for where I want the product to go.

 

Drifter.

-----------------------------------------------------------------------------

OSC user for years and no coder, so I've earned my stripes.

 

Feel free to private message me.

Link to comment
Share on other sites

HI there, the shipping modules will produce shipping prices only for the destination address. So if you are based in the USA and would like it shipped to a UK address for example, you would have to enter an entrry into your address book for the UK address, the module will then work out the costs for the new address.

 

Thats the theory anyway.

 

This contrib involves no editing, just upload the files and test, if it fails delete the files.

Link to comment
Share on other sites

HI there, the shipping modules will produce shipping prices only for the destination address. So if you are based in the USA and would like it shipped to a UK address for example, you would have to enter an entrry into your address book for the UK address, the module will then work out the costs for the new address.

 

Thats the theory anyway.

 

This contrib involves no editing, just upload the files and test, if it fails delete the files.

 

Will do, I'm installing a clean Creloaded over the weekend so I'll give a go on that for fun :thumbsup:

-----------------------------------------------------------------------------

OSC user for years and no coder, so I've earned my stripes.

 

Feel free to private message me.

Link to comment
Share on other sites

Hi

Have just installed the contrib today in time for the changes tomorrow. A very big thanks as I would of forgot all about the price changes and been knee deep in 'stuff'.

One thing I can't seem to sort out though.

 

I have entered all the figures onto the weight tables in line with the instructions but whenever I go to checkout with, say a 0.5Kg item in my basket, the total wieght of my basket increases by 3Kg. And I don't know why?

 

Everything was fine before I installed these.

 

Any ideas?

Rob

Link to comment
Share on other sites

No tare weight as far as I can see. I have checked all other modules to check for interference but they are all set to defaults with nothing to do about weight.

Packaging costs are 0.

Link to comment
Share on other sites

Sorted it out!

In catalog/includes/classes/shipping.php around line 56 I changed:

$shipping_weight = $shipping_weight + SHIPPING_BOX_WEIGHT;

to:

$shipping_weight = $shipping_weight;

Does anyone know what file defines SHIPPING_BOX_WEIGHT?

Link to comment
Share on other sites

Version 1.2 Uploaded (http://www.oscommerce.com/community/contributions,4473)

 

Cosmetic changes to checkout confirmation.

 

If you selected to checkout by Royal Mail International Signed For, the text in checkout_confirmation.php was too long and caused layout problems.

 

The new file version 1.2 fixes this.

 

The only file changed is catalog/includes/modules/shipping/airmail.php

 

Everything else is untouched. If you downloaded a previous version, simply overwrite the airmail.php file with the one included in the new version.

 

Keep PM'ing me with any bugs or faults and I will do my best to resolve them ASAP.

Link to comment
Share on other sites

OK I didnt follow the instructions (I Think) in that I did not need all modules, so only installed what I needed. I got instances of ?0.00 options coming up, and of course if its free you can bet your life some plonker will choose it.

 

If you get this like me, in the module where you get it, or add it to all to make sure there is no chance any one picks free shipping!!

 

 

 

if ($error == true) $this->quotes['error'] = MODULE_SHIPPING_CITYLINK_INVALID_ZONE;

 

and add this after it

 

if ($shipping_method == MODULE_SHIPPING_CITYLINK_UNDEFINED_RATE ) $this->quotes['error'] = $shipping_method;

 

All you need to do is keep an eye on the module name and change the

 

MODULE_SHIPPING_CITYLINK_UNDEFINED_RATE

 

name of the module

 

The code above and below was done in the city link module

 

/*   $Id: Initial CityLink Nextday by Stuart Newton 21 August 2006
 Demo: http://www.almatcomputers.co.uk
 Rates: 10:11.6,15:14.1,20:16.60,25:19.1,30:21.6,35:24.1,40:26.6,45:29.1,50:31.6,55:34.1,60:36.6,65:39.1,70:41.6,75:44.1,80:46.6,100:56.6,125:69.1,150:81.6,200:106.6
*/

 class citylink {
var $code, $title, $description, $enabled, $num_zones;

// class constructor
function citylink() {
global $order, $total_weight;
  $this->code = 'citylink';
  $this->title = MODULE_SHIPPING_CITYLINK_TEXT_TITLE;
  $this->description = MODULE_SHIPPING_CITYLINK_TEXT_DESCRIPTION;
  $this->sort_order = MODULE_SHIPPING_CITYLINK_SORT_ORDER;
  $this->icon = DIR_WS_ICONS . 'shipping_citylink.gif'; // upload icon to catalog/images/icon directory
  $this->tax_class = MODULE_SHIPPING_CITYLINK_TAX_CLASS;
  $this->enabled = ((MODULE_SHIPPING_CITYLINK_STATUS == 'True') ? true : false);
  $this->num_zones = 1;


}



// class methods
function quote($method = '') {
global $order, $total_weight, $shipping_weight, $shipping_num_boxes;
  $dest_country = $order->delivery['country']['iso_code_2'];
  $dest_zone = 0;
  $error = false;
	  if ($order->delivery['country']['iso_code_2'] == 'GB')  {  // Only UK Customers to see shipping method. Hide everbody else.
	  for ($i=1; $i<=$this->num_zones; $i++) {
	  $countries_table = constant('MODULE_SHIPPING_CITYLINK_COUNTRIES_' . $i);
	  $country_zones = split("[,]", $countries_table);
	  if (in_array($dest_country, $country_zones)) {
		$dest_zone = $i;
		break;
	  }
	}
// Enhanced charges applied to Citylink weights		
$ic = 0;
if ($total_weight > 30) $ic = 10;
if ($total_weight > 100) $ic = 15;
if ($total_weight > 150) $ic = 25;
if ($total_weight > 200) $ic = 45;

  if ($dest_zone == 0) {
	$error = true;
  } else {
	$shipping = -1;
	$zones_cost = constant('MODULE_SHIPPING_CITYLINK_COST_' . $dest_zone);

	$zones_table = split("[:,]" , $zones_cost);
	$size = sizeof($zones_table);
	for ($i=0; $i<$size; $i+=2) {
	  if ($shipping_weight <= $zones_table[$i]) {
		$shipping = $zones_table[$i+1];
		if(tep_not_null($method) )
		// Text shown on Checkout_Confirmation
		$shipping_method = ''; // Leaving this entry blank causes only the shipping title to show i.e Royal Mail 1st Class Std 	  
		else
		// Text shown on Checkout_shipping -  Delivery Weight : 0.7 Kg's (Ships normally within 1 to 3 days)
		$shipping_method = MODULE_SHIPPING_CITYLINK_TEXT_WAY . ' : ' . $shipping_weight . ' ' . MODULE_SHIPPING_CITYLINK_TEXT_UNITS . ' ' . MODULE_SHIPPING_CITYLINK_DELIVERY_TIMES; 
		break;
	  }
	}

	if ($shipping == -1) {
	  $shipping_cost = 0;
	  $shipping_method = MODULE_SHIPPING_CITYLINK_UNDEFINED_RATE;
	} else {
	  $shipping_cost = ($shipping * $shipping_num_boxes) + $ic + constant('MODULE_SHIPPING_CITYLINK_HANDLING_' . $dest_zone);
	}
  }

  $this->quotes = array('id' => $this->code,
						'module' => MODULE_SHIPPING_CITYLINK_TEXT_TITLE,
						'methods' => array(array('id' => $this->code,
												 'title' => $shipping_method,
												 'cost' => $shipping_cost)));

  if ($this->tax_class > 0) {
	$this->quotes['tax'] = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
  }

  if (tep_not_null($this->icon)) $this->quotes['icon'] = tep_image($this->icon, $this->title);

  if ($error == true) $this->quotes['error'] = MODULE_SHIPPING_CITYLINK_INVALID_ZONE;

if ($shipping_method == MODULE_SHIPPING_CITYLINK_UNDEFINED_RATE ) $this->quotes['error'] = $shipping_method;

  return $this->quotes;
}
}

function check() {
  if (!isset($this->_check)) {
	$check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_CITYLINK_STATUS'");
	$this->_check = tep_db_num_rows($check_query);
  }
  return $this->_check;
}

function install() {
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Enable Initial Citylink Delivery', 'MODULE_SHIPPING_CITYLINK_STATUS', 'True', 'Do you want to offer this shipping option?', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");

  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Tax Class', 'MODULE_SHIPPING_CITYLINK_TAX_CLASS', '0', 'Use the following tax class on the shipping fee.', '6', '0', 'tep_get_tax_class_title', 'tep_cfg_pull_down_tax_classes(', now())");

  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_SHIPPING_CITYLINK_SORT_ORDER', '7', 'Sort order of display (1 shown first 99 etc shown last to customer)', '6', '0', now())");

  for ($i = 1; $i <= $this->num_zones; $i++) {
	$default_countries = '';
	if ($i == 1) {
	  $default_countries = 'GB';
	}
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('ISO Country Code', 'MODULE_SHIPPING_CITYLINK_COUNTRIES_" . $i ."', '" . $default_countries . "', 'Enter the two digit ISO code for which this shipping method applies too. (Default: GB)', '6', '0', now())");

  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Initial Citylink Rates', 'MODULE_SHIPPING_CITYLINK_COST_" . $i ."', '10:11.6,15:14.1,20:16.60,25:19.1,30:21.6,35:24.1,40:26.6,45:29.1,50:31.6,55:34.1,60:36.6,65:39.1,70:41.6,75:44.1,80:46.6,100:56.6,125:69.1,150:81.6,200:106.6', 'Enter values upto 5,2 decimal places. (12345.67) Example: .1:1,.25:1.27 - Weights less than or equal to 0.1Kg would cost ?1.00, Weights less than or equal to 0.25g but more than 0.1Kg will cost ?1.27. Do not enter KG or ? symbols.', '6', '0', now())");
	tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Packaging / Handling Fee', 'MODULE_SHIPPING_CITYLINK_HANDLING_" . $i."', '0', 'If you want to add extra costs to customers for jiffy bags etc, the cost can be entered below (eg enter 1.50 for a value of ?1.50)', '6', '0', now())");
  }
}

function remove() {
  tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
}

function keys() {
  $keys = array('MODULE_SHIPPING_CITYLINK_STATUS', 'MODULE_SHIPPING_CITYLINK_TAX_CLASS', 'MODULE_SHIPPING_CITYLINK_SORT_ORDER');

  for ($i=1; $i<=$this->num_zones; $i++) {
	$keys[] = 'MODULE_SHIPPING_CITYLINK_COUNTRIES_' . $i;
	$keys[] = 'MODULE_SHIPPING_CITYLINK_COST_' . $i;
	$keys[] = 'MODULE_SHIPPING_CITYLINK_HANDLING_' . $i;
  }

  return $keys;
}
 }
?>

Link to comment
Share on other sites

Sorry my brain has gone to sleep today, what problem did you find and how does the code supplied fix this, sorry suffering from a hangover and just cannot focus on code issues today.

 

If the code modification is justified I will apply it to all files and upload a new version.

Link to comment
Share on other sites

Hi Stuart,

Let me start by saying there is nothing wrong with your contribution, what I did was not to follow the instructions, hack out the modules for the services that we use and leave the rest. I also modded some coded to suit my site, so what I have proposed is just a fail safe should there be any others like me who dont read instructions!

 

OK I used First and second class recorded, RM standard parcels, special delivery, Parcelforce 48 and City link. Having read the instructions to remove the limits if you only use certain modules of course being a man I totally ignored it and set about testing my work. I put into my cart something that weighed 2kg and cost ?18.75. It allowed me to select RM 1st class recorded and stated that this method was not suitable and then allowed me to select it with a value of ?0.00.

 

I doubt this is worthy of a release in its own right, bu might be worth including in any later ones as a fail safe? Or if you feel its just me, your more then likely right.........!

 

Thanks for a great contribution btw!

 

I want to go on an use your coding for Parcel force euro and international services, this ok with you?

Link to comment
Share on other sites

yes, feel free, any more errors or strange doings just post away. The more people that use these contribs the more stable and bug free they become.

 

Will be adding hopefully more couriers and international options, but the prices vary widely with different couriers and if you use a courier the chances are you have an account with them and your rates will vary against another user of the contrib.

Link to comment
Share on other sites

I'm getting the same ?0.00 postage option once I go over a certain weight. No problems with 1 item in the cart but if I add 10 of the same items and go over the maximum limit for a postage option it lets me select that postage option at ?0.00.

 

http://shop.welovefragile.co.uk

 

I don't think I read the instructions properly either LOL :blush:

Link to comment
Share on other sites

Yeah, read the instructions, if using the royal mail modules, you will either have to install a courier like parcels or citylink, or if you do not use a courier, you will need to remove the limits from the royal mail modules to prevent this

Link to comment
Share on other sites

IMPORTANT NOTES IMPORTANT NOTES IMPORTANT NOTES IMPORTANT NOTES IMPORTANT NOTES

=================================================================

 

IF YOU DECIDE TO INSTALL ONLY THE ROYAL MAIL MODULES AND NOT ANY OF THE COURIERS OR PARCEL FORCE MODULES, PLEASE OPEN THE ROYAL MAIL MODULES AND REMOVE THE LIMITS.

If you do not remove the limits and you have no other shipping modules installed, if someone buys something from you over ?32.00, there will be no shipping option shown, hence your customer can checkout and pay ?0.00 shipping.

 

To summarise, either install Royal Mail modules with a courier (Standard Parcels, Citylink or Parcelforce) or if you install the Royal Mail modules on their own, (RM 1st, RM 2nd, RM 1st REC or RM 2nd REC) edit the files to remove the limits.

Link to comment
Share on other sites

I've actually got the Stanard Parcels module installed too and it's showing a price, but it hasn't stopped Royal Mail 2nd class from showing ?0.00. Do I need to install Citylink and Parcelforce too?

 

Royal Mail 1st Class Standard

Delivery Weight : 1.1 Kg's (Ships normally within 1 to 3 days) ?4.74

 

Royal Mail 2nd Class Standard

The shipping rate cannot be determined at this time (1.00Kg cart weight exceeded ?0.00

 

Royal Mail Standard Parcels

Delivery Weight : 1.1 Kg's (Insured upto ?500.00, ships within 3 to 5 days) ?5.95

 

Royal Mail Special Delivery

Delivery Weight : 1.1 Kg's (Insured upto ?2500.00, ships Nextday) ?8.90

Link to comment
Share on other sites

Just had a play around. I've only got one item on the shop so it's easy to replicate. If I add one item and check out there's no problem. If I up the quantity to 35 of the same item there's no problem...all the standard Royal Mail options go and I'm just left with couriers. If I change the quantity to 10 items I hit the problem where Royal Mail 2nd Class Standard appears and offers free postage.

Any idea where I might have gone wrong?

Edited by fragile
Link to comment
Share on other sites

Further playing reveals I don't get a problem when the product's quantity is 9 or 11. Maybe it's something to do with the items weight being set to 0.10 and the quantity being 10 means it's weight it dead on the 1Kg mark?

Edited by fragile
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...