Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[CONTRIB] UK Royal Mail & Overseas Shipping Methods


Guest

Recommended Posts

I have Installed this contribution sucsessfully;

 

UK Royal Mail & Overseas Shipping Methods for specific categories of products for osCommerce Online Merchant v2.2

 

Modified contribution by: Alexander Dimelow

 

Based on the Original “UK Royal Mail & Overseas Shipping Methods 21st Aug Prices” contribution:

http://addons.oscommerce.com/info/4473

 

 

everything seems to work OK .. but when i need to Edit an Order this error occours

 

Fatal error: Call to undefined function tep_get_categories_name() in /public_html/osctestshop/includes/modules/shipping/parcelforce48.php on line 89

 

i have Order Editor also installed Mod 1435

http://addons.oscommerce.com/info/1435

 

i would gues that the problem is in the edit_orders.php and not in the parcelforce48.php

 

any chance of a little help ?

Link to comment
Share on other sites

I have Installed this contribution sucsessfully;

 

UK Royal Mail & Overseas Shipping Methods for specific categories of products for osCommerce Online Merchant v2.2

 

Modified contribution by: Alexander Dimelow

 

Based on the Original “UK Royal Mail & Overseas Shipping Methods 21st Aug Prices” contribution:

http://addons.oscommerce.com/info/4473

So you installed contribution #5979, and not this contribution.

 

everything seems to work OK .. but when i need to Edit an Order this error occours

 

Fatal error: Call to undefined function tep_get_categories_name() in /public_html/osctestshop/includes/modules/shipping/parcelforce48.php on line 89

 

i have Order Editor also installed Mod 1435

http://addons.oscommerce.com/info/1435

 

i would gues that the problem is in the edit_orders.php and not in the parcelforce48.php

 

any chance of a little help ?

You did edit the files as suggested in the install docs for contribution #5979 ??

 

I imagine the error is caused because you have failed to add the function declaration(s) in the correct places.

 

I'm sorry I can't help more but I updated contribution #4473 a few months back, and am not connected with #5979.

 

Best regards

 

Chris Lander

LABBS Web Services

Link to comment
Share on other sites

  • 2 weeks later...

Hi Chris,

I have the old version installed for along time (sorry) and I have it working well except that I get the "Cart Weight Exceeded" error occasionally. Now that I'm adding a courier service the bug needs fixing for me now. I've been reading the thread and found this from you:

 

I also found another problem, when deciding if a shipment was over the method maximum I was checking on total weight from the order rather than the actual weight of packages being shipped when calculated in line with the variables entered at Admin->Configuration->Shipping/Packaging. In rare circumstances where the total weight of products was close to the maximum shipping weight of a method, when the shipping weight was calculated it exceeded the methods maximum weight and caused the methods _UNDEFINED_RATE language text to be displayed.

 

The methods have all been updated so that they are enabled if packages being shipped are within the methods weight restrictions.

 

As I am happy with my current module, are you able to say what you changed to resolve this issue? I know it's to do with the tare weight & item weight coming in close to max weight.

 

Hope you can help - I'm short of time for re-testing a new module at the mo. Hope you understand.

 

Thanks

I'm feeling lucky today......maybe someone will answer my post!

I do try and answer a simple post when I can just to give something back.

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

PM me? - I'm not for hire

Link to comment
Share on other sites

As I am happy with my current module, are you able to say what you changed to resolve this issue? I know it's to do with the tare weight & item weight coming in close to max weight.

 

Hope you can help - I'm short of time for re-testing a new module at the mo. Hope you understand.

Basically in the shipping modules the decision to use a shipping method is taken in the function with the same name as the class, e.g. in class rmstandardparcel within function rmstandardparcel.

 

In v1.2 the method's were checking against $total_weight, which is the total weight of the products in the cart. The quote functions of the methods receive the shipping weight and number of boxes, so in some rare cases the shipping weight could exceed a methods maximum.

 

What I did was calculate the actual shipping weight by using code similar to that in ..../includes/classes/shipping.php line# 70 - 79, and then calculate if the shipment was being split into several boxes. The new v2.20 methods allow configuration of shipment splitting by different weight limits for each method, so the code is a little more complex than you'll need, but this is the code I ended up with.

		// Calculate shipping weight taking into account
	//  Maximum Package Weight you will ship
	//  Package Tare weight
	//  Larger packages percent increase
	//
	//  as is done in ..../includes/classes/shipping.php line# 70 - 79
	//
	if (SHIPPING_BOX_WEIGHT >= $total_weight*SHIPPING_BOX_PADDING/100) {
		$shipping_weight = $total_weight+SHIPPING_BOX_WEIGHT;
	} else {
		$shipping_weight = $total_weight + ($total_weight*SHIPPING_BOX_PADDING/		100);
	}

	// Default to split using store maximum shipping weight
	$my_max_shipping_weight = SHIPPING_MAX_WEIGHT;
	// Split shipment using Method Maximum Shipment Weight?
	if ($this->weight_split) {
		if (SHIPPING_MAX_WEIGHT > MODULE_SHIPPING_RMSTANDARDPARCEL_MAX_WEIGHT) {
			$my_max_shipping_weight = MODULE_SHIPPING_RMSTANDARDPARCEL_MAX_WEIGHT;
		}
	}

	// Split shipment into the required number of boxes
	if ($shipping_weight > $my_max_shipping_weight) {
		$shipping_num_boxes = ceil($shipping_weight/$my_max_shipping_weight);
		$shipping_weight = $shipping_weight/$shipping_num_boxes;
	}

	// Ensure we have Set number of boxes and weight
	$shipping_num_boxes = (isset($shipping_num_boxes) ? $shipping_num_boxes : 1);
	$shipping_weight = (isset($shipping_weight) ? $shipping_weight : 0);
	$my_shipping_num_boxes = $shipping_num_boxes;
	$my_shipping_weight = $shipping_weight;

	// Split shipment on method Maximum Shipment Value?
	if ($this->value_split) {
		// Calc the value and weight of each package being shipped
		if ( ($order->info['subtotal'] / $shipping_num_boxes) > MODULE_SHIPPING_RMSTANDARDPARCEL_MAX_VALUE) {
			$my_shipping_num_boxes = ceil($order->info['subtotal']/MODULE_SHIPPING_RMSTANDARDPARCEL_MAX_VALUE);
			$my_shipping_weight = ($shipping_weight * $shipping_num_boxes) / $my_shipping_num_boxes;
		}
	}

	// Only ship if packet value exceeds method minimum value
	if ( ($order->info['subtotal'] / $my_shipping_num_boxes) < MODULE_SHIPPING_RMSTANDARDPARCEL_MIN_VALUE) {
		$this->enabled = false;
	}

	// Only ship if packet value does not exceed method maximum value
	if ( ($order->info['subtotal'] / $my_shipping_num_boxes) > MODULE_SHIPPING_RMSTANDARDPARCEL_MAX_VALUE) {
		$this->enabled = false;
	}

	// Only ship if packet weight exceeds method minimum value
	if ( $my_shipping_weight < MODULE_SHIPPING_RMSTANDARDPARCEL_MIN_WEIGHT) {
		$this->enabled = false;
	}

	// Only ship if packet weight does not exceed method maximum value
	if ( $my_shipping_weight > MODULE_SHIPPING_RMSTANDARDPARCEL_MAX_WEIGHT) {
		$this->enabled = false;
	}

 

Above you'll find the values entered in Admin->Configuration->Shipping/Packaging as:-

 

SHIPPING_MAX_WEIGHT: Maximum Package Weight you will ship

SHIPPING_BOX_WEIGHT: Package Tare weight

SHIPPING_BOX_PADDING/100: Larger packages percent increase

 

 

All my new methods use similar code to calculate the number of boxes and their weights, and to date it has proved reliable.

 

I hope you'll get around to testing the v2.20 methods before too long, they allow a greater degree of flexibility when setting up your shipping, along with providing a number of options to control the final text output seen by a customer in the checkout.

 

Best regards

LABBS Web Services

Link to comment
Share on other sites

Now that I'm adding a courier service

Which courier service are you working on creating a method file for?

 

 

If you want to use the core of my RMv2.20 code to create a specific method for a service, then there are two scenarios...

The first is if your method is specific to one country ONLY, in which case I suggest you start with my RMFIRST and RMFIRSTREC methods.

The second is International Shipping, in which case I'd suggest starting with my RMAIRMAIL and RMAIRSURE methods.

 

The difference in each scenario is a method with/without additional insurance cover.

 

 

The code base of the v2.20 version was created with the view that others may apply it to their own scenario by using an appropriate example to work from, and then adapt it to work with their shipping suppliers. The code was also constructed with the intention that people from countries other than the UK would be easily able adapt it to work with their local postal services.

 

Once you have worked out how to implement your courier service method (with either v1.2 or v2.20) then please publish it, as I am certain that it will be of interest to many of us. I would also be happy to consider your contribution for inclusion (credited of course!) within any future FULL release of this shipping package made by me.

 

Best regards

LABBS Web Services

Link to comment
Share on other sites

  • 1 month later...

Hi There,

 

I have played with this contribution a few times and have come accross a problem that I think I know the cause but do not know how to fix:

 

I have a product that weighs 0.15, but the only option for delivery is coming up as standard parcels, I pondered for a while then realised that the cost of the item is above the £39 compensation for the recorded delivery option.

 

Is there a way to have the contribution ignore the value for insurance reasons and just provide the postal options based on the package weight?

 

Thanks a bunch

 

Ricardo

Complete Newbie On The Learn - Not A Programmer

But Learning As I Go

Link to comment
Share on other sites

Is there a way to have the contribution ignore the value for insurance reasons and just provide the postal options based on the package weight?

In the v2.20 modules you can set minimum and maximum for weight and price in each method.

 

The default settings limit each method using weight limitations from Royal Mail, and the value of items by the compensation available from Royal Mail.

 

So if you want to enable RM First Recorded for values above £39 then in the admin interface increase 'Maximum value to ship' to what you need. Remember though that Royal Mail will ONLY give you a maximum of £39 compensation in the event that your shipment goes astray.

 

Best regards

LABBS Web Services

Link to comment
Share on other sites

Where is it that I can disable to automatic addition of extra insurance for more valuable items?

In the v2.2.0 modules for those methods that have insurance cover there are compensation rates, that are a string of value:additional cost pairs separated by commas.

 

e.g. in RM Standard Parcels you will find

 

RM Standard Parcels Compensation Rates

39:0,100:1,250:2.25,500:3.5

This means that RM automatically give you £39 cover in the basic price, but you can purchase additional cover for increased shipment values, for example £250 cover for an additional £2.25.

 

 

In its default install you'll see for a cart value of £58.47 and a shipping weight of 1.35Kg, this reults in the shipping option being displayed in the checkout as:

 

Royal Mail Standard Parcels
Delivery Weight : 1 package of 1.35 Kg's (Insured upto £100, ships normally within 3 to 5 days) 	£5.41

 

The basic shipping cost of £4.41 plus an additional £1 for cover up to £100.

 

 

 

You can remove compensation cover by clearing the string in the compensation rates field. This will result in the shipping option being displayed as:

 

Royal Mail Standard Parcels
Delivery Weight : 1 package of 1.35 Kg's (Uninsured, ships normally within 3 to 5 days) 	£4.41

 

 

You could further remove the insurance display by disabling it in the method, select the 'No' radio button under 'Display Insurance', which then results in the shipping option being displayed as:

 

Royal Mail Standard Parcels
Delivery Weight : 1 package of 1.35 Kg's (Ships normally within 3 to 5 days) 	£4.41

 

Best regards

LABBS Web Services

Link to comment
Share on other sites

  • 1 month later...

PHP 5.3 deprecated function split()

 

Hi Chris,

 

Just working my way through PHP 5.3 locally (before my host upgrades!) and came across a the need to replace split() in the includes/modlues/shipping/xxx.php files. I have posted below my "workings", replacing split() with preg_split() (although explode() or others may be better used?!)

 

For those who wish to stay ahead of PHP 5.3, these are the amendments to make (which will clear the deprecated warnings for split()).

 

*catalog*/includes/modules/shipping/rmfirst.php find:

	// Check if destination is a valid one for this method
	if (defined('MODULE_SHIPPING_RMFIRST_COUNTRIES_' . $this->num_zones)) {
		$countries_table = constant('MODULE_SHIPPING_RMFIRST_COUNTRIES_' . $this->num_zones);
		$country_zones = split("[,]", $countries_table);

 

Replace with:

	// Check if destination is a valid one for this method
	if (defined('MODULE_SHIPPING_RMFIRST_COUNTRIES_' . $this->num_zones)) {
		$countries_table = constant('MODULE_SHIPPING_RMFIRST_COUNTRIES_' . $this->num_zones);
		$country_zones = preg_split("/[,]/", $countries_table);

 

Next find:

	// Check if destination is a valid one for this method
	$countries_table = constant('MODULE_SHIPPING_RMFIRST_COUNTRIES_' . $this->num_zones);
	$country_zones = split("[,]", $countries_table);

 

Replace with:

	// Check if destination is a valid one for this method
	$countries_table = constant('MODULE_SHIPPING_RMFIRST_COUNTRIES_' . $this->num_zones);
	$country_zones = preg_split("/[,]/", $countries_table);

 

Next find:

		// Find the shipping cost
		$zones_table = split("[:,]" , $zones_cost);

 

Replace with:

		// Find the shipping cost
		$zones_table = preg_split("/[:,]/" , $zones_cost);

 

*catalog*/includes/modules/shipping/rmfirstrec.php find:

	// Check if destination is a valid one for this method
	if (defined('MODULE_SHIPPING_RMFIRSTREC_COUNTRIES_' . $this->num_zones)) {
		$countries_table = constant('MODULE_SHIPPING_RMFIRSTREC_COUNTRIES_' . $this->num_zones);
		$country_zones = split("[,]", $countries_table);

 

Replace with:

	// Check if destination is a valid one for this method
	if (defined('MODULE_SHIPPING_RMFIRSTREC_COUNTRIES_' . $this->num_zones)) {
		$countries_table = constant('MODULE_SHIPPING_RMFIRSTREC_COUNTRIES_' . $this->num_zones);
		$country_zones = preg_split("/[,]/", $countries_table);

 

Next find:

			// Check if insurance is available	
			$compensation_table = split("[:,]" , $compensation_cost);

 

Replace with:

			// Check if insurance is available
			$compensation_table = preg_split("/[:,]/" , $compensation_cost);

 

Next find:

	// Check if destination is a valid one for this method
	if (defined('MODULE_SHIPPING_RMFIRSTREC_COUNTRIES_' . $this->num_zones)) {
		$countries_table = constant('MODULE_SHIPPING_RMFIRSTREC_COUNTRIES_' . $this->num_zones);
		$country_zones = split("[,]", $countries_table);

 

Replace with:

	// Check if destination is a valid one for this method
	if (defined('MODULE_SHIPPING_RMFIRSTREC_COUNTRIES_' . $this->num_zones)) {
		$countries_table = constant('MODULE_SHIPPING_RMFIRSTREC_COUNTRIES_' . $this->num_zones);
		$country_zones = preg_split("/[,]/", $countries_table);

 

Next find:

			// Get any insurance values entered
			$compensation_cost = constant('MODULE_SHIPPING_RMFIRSTREC_COMPENSATION_' . $this->num_zones);
			$compensation_table = split("[:,]" , $compensation_cost);

 

Replace with:

			// Get any insurance values entered
			$compensation_cost = constant('MODULE_SHIPPING_RMFIRSTREC_COMPENSATION_' . $this->num_zones);
			$compensation_table = preg_split("/[:,]/" , $compensation_cost);

 

Next find:

			// Get the cost to ship to the destination zone
			$zones_cost = constant('MODULE_SHIPPING_RMFIRSTREC_COST_' . $this->num_zones);
			$zones_table = split("[:,]" , $zones_cost);

 

Replace with:

			// Get the cost to ship to the destination zone
			$zones_cost = constant('MODULE_SHIPPING_RMFIRSTREC_COST_' . $this->num_zones);
			$zones_table = preg_split("/[:,]/" , $zones_cost);

 

This may take some time typing out the necessary adjustments for all files. Chris, I may upload a *new* fileset in the contribution page (could be a hell of a lot quicker!). However, let me know if you would rather compile the changes yourself (you may have updates to add anyway!)

 

Cheers

James

Link to comment
Share on other sites

A new package has been uploaded to incorporate the PHP 5.3 fix for split()

 

For those who wish to update, simply overwrite your exisiting *catalog*/includes/modules/shipping/ files with the ones contained in the package. However, this is a FULL package if you are a new user.

 

Version 2.2.1 is located here

 

Thanks to Chris for this superb shipping module!

 

James

Link to comment
Share on other sites

Hi,

 

Have a small problem with the Parcelforce48 module in that I can't set it to cover world wide deliveries.

UK and Europe were easy enough - just added valid ISO country codes.

 

I checked the Parcelforce website and it has 2 scales one for Europe and one for the rest of the world.

Is there any way I can get this module to be worldwide without adding every country code in the world?

 

Thanks in advance

 

Steve

Link to comment
Share on other sites

A new package has been uploaded to incorporate the PHP 5.3 fix for split()

 

For those who wish to update, simply overwrite your exisiting *catalog*/includes/modules/shipping/ files with the ones contained in the package.

 

Hi James,

I wondered if it would be possible to detail the code changes for what was updated to fix the php depreciated function? I'm using a previous version so can't just "drop in" the files. I'm assuming the same PHP issue is in the versions before Chris's versions?

 

Cheers

I'm feeling lucky today......maybe someone will answer my post!

I do try and answer a simple post when I can just to give something back.

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

PM me? - I'm not for hire

Link to comment
Share on other sites

Hi Tigergirl,

 

No problem.. In the latest version by Chris (and possibly ones preceding (although I haven't checked)), the function split() has been used. This has become deprecated (throws a deprecated error) in PHP 5.3.x and will be removed by PHP 6.0.x

 

The files I edited for the updated package were all located in *catalog*/includes/modules/shipping/ *and then any rm__.php file for this contribution.

 

The split() function can be replaced by a few others, I chose preg_split().

 

If you like, PM me and I'll reply with my email address, whereby you can (if you wish) send over the files associated with this shipping contribution and I'll update them for you.

Link to comment
Share on other sites

In the latest version by Chris (and possibly ones preceding (although I haven't checked)), the function split() has been used. This has become deprecated (throws a deprecated error) in PHP 5.3.x and will be removed by PHP 6.0.x

 

The files I edited for the updated package were all located in *catalog*/includes/modules/shipping/ *and then any rm__.php file for this contribution.

 

 

Hi James,

I'd rather make the changes myself (you offer too much when saying you will edit the files for others)

Version 20/08/06 - I checked includes/modules/shipping/rmstandardparcel.php

 

I found 2 instances of split()

$country_zones = split("[,]", $countries_table);

$zones_table = split("[:,]" , $zones_cost);

 

Should this be changed to:

$country_zones = preg_split("/[,]/", $countries_table);

$zones_table = preg_split("/[:,]/" , $zones_cost);

 

Yes and I was always going to try the newer version but have too many other things on my to do list! ...if it ain't broke don't fix it is my motto (although there was still one bug on the version I'm using.)

 

Cheers

I'm feeling lucky today......maybe someone will answer my post!

I do try and answer a simple post when I can just to give something back.

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

PM me? - I'm not for hire

Link to comment
Share on other sites

Hi Tigergirl,

 

I really wouldn't have minded applying the edits for you.. it wouldn't have taken long to do! Anyway, for your rmstandardparcel.php, the edits you suggest look spot on. If you have any more of the shipping modules for the contribution, the same changes to split() would apply.. by replacing with preg_split("/.../")

 

Cheers

James

Link to comment
Share on other sites

If you have any more of the shipping modules for the contribution, the same changes to split() would apply.. by replacing with preg_split("/.../")

 

Ok, cool, will check the other files out and test (although I don't have php 5.3 yet but who knows when the host decides to upgrade and not tell me (again)...

 

Thanks for the heads up. Now, if I send you my "To Do" list do you fancy having a bash? :thumbsup:

I'm feeling lucky today......maybe someone will answer my post!

I do try and answer a simple post when I can just to give something back.

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

PM me? - I'm not for hire

Link to comment
Share on other sites

Ok, cool, will check the other files out and test (although I don't have php 5.3 yet but who knows when the host decides to upgrade and not tell me (again)...

 

Thanks for the heads up. Now, if I send you my "To Do" list do you fancy having a bash? :thumbsup:

Lol.. no problem.. I'll add it to my "to do" list too.. this "game" is never ending!

 

Re: PHP 5.3 - there are a number of localhosts out there now offering PHP 5.3 as their runtime. It may be worth getting your hands on one to stay ahead of your host. You'll be surprised at how many deprecated functions need to be dealt with.. not just with this contribution..

Link to comment
Share on other sites

Hello,

 

I have installed Parcelforce 48 for my store which is based on USA but has shipping centre in UK.(I have used parcelforce 48 only from UK_SHIPPING_METHODS_v2.2.1)

It shows up the rate when I have set my store in US. but don't know whether its showing perfect or not.

Also after 2500 amount, the parcelforce option does not come up.

 

Can anyone help me telling that whats happening?

 

My configuration :

Parcelforce 48 v2.2.1

 

Enable Parcelforce48

True

 

Tax Class

--none--

 

Sort Order

7

 

Minimum weight to ship

0

 

Maximum weight to ship

100

 

Split shipments on maximum weight to ship

False

 

Minimum value to ship

0

 

Maximum value to ship

2500

 

Split shipments on maximum value to ship

False

 

Display delivery weight

True

 

Display Insurance

True

 

Display delivery time

True

 

Valid ISO Country Codes

GB

 

Parcelforce48 Rates

10:15.99, 12:19.99, 14:20.99, 16:21.99, 18:21.99, 20:21.99, 22:26.99, 24:30.99, 26:34.99, 28:38.99, 30:42.99, 35:52.99, 40:62.99, 45:72.99, 50:82.99, 55:92.99, 60:102.99, 65:112.99, 70:122.99, 75:132.99, 80:142.99, 85:152.99, 90:162.99, 95:172.99, 100:182

 

Parcelforce48 Compensation Rates

150:0,500:12,1000:24,1500:36, 2000:48,2500:60

 

Packaging / Handling Fee

0

 

Shipping/Packaging in Configuration :

 

Country of Origin United States

Postal Code 92211 Info

Enter the Maximum Package Weight you will ship 5000

Package Tare weight. 3

 

Thanks in advance. Please reply ASAP. I am on a struck :-"

Edited by ruma
Link to comment
Share on other sites

 

Also after 2500 amount, the parcelforce option does not come up.

 

 

This setting:

Maximum value to ship

2500

I'm feeling lucky today......maybe someone will answer my post!

I do try and answer a simple post when I can just to give something back.

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

PM me? - I'm not for hire

Link to comment
Share on other sites

Hi folks, hope you can help.

 

I'm using this module in combination with One Page Checkout and Simple Template System.

 

When i try to checkout it automatically comes up with the lowest price option and that's it. it doesn't show any other options so customers couldn't even see that they have different options.

 

I've checked and re-checked the catalog/checkout_shipping.php file many, many times and i've put it in exactly as it should be. I notice someone asked before if this was compatable with one page checkout, but i can't find an answer - are the two contributions uncompatiable?

 

thanks for your help,

 

barneybruce

Link to comment
Share on other sites

erm, DOH!

 

forget that last post - it's working fine NOW for some reason! duh!

 

barneybruce

 

Hi folks, hope you can help.

 

I'm using this module in combination with One Page Checkout and Simple Template System.

 

When i try to checkout it automatically comes up with the lowest price option and that's it. it doesn't show any other options so customers couldn't even see that they have different options.

 

I've checked and re-checked the catalog/checkout_shipping.php file many, many times and i've put it in exactly as it should be. I notice someone asked before if this was compatable with one page checkout, but i can't find an answer - are the two contributions uncompatiable?

 

thanks for your help,

 

barneybruce

Edited by barneybruce
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...