Jump to content
Sign in to follow this  
alqamardesigns

Help Needed with Setting Weight on Shipping

Recommended Posts

Hey there,

 

It has taken me ages to figure out this weight per product / shipping.

My client wanted to set an individual price per product for his company, but I had already implemented the oscommerce script.

Anyhow, the client has agreed to this set up.

 

He has provided me with the following weight/shipping for UK:

 

0-500G = £2.50

500G-1000KG = £5.00

1-2 KG = £8.00

2-3KG = £10.00

 

Please could someone kindly help me to put that into a readable formulae that I can use in Admin

Modules > Shipping > Zone Rate

 

I have two Zone Rates : Europe and UK

Zone Rate 1 is UK, need to fill in details for the Shipping Table

 

help!!!

 

Thanks!

Share this post


Link to post
Share on other sites
ignore this

 

1kg = £3

2kg = £10

3.5kg = £14

 

^

 

Okay i have got this working on the following code:

1:3.00,2:7.00,3:4:00

 

could someone explain to me how the formulae works, ive got it working all by guess work!

 

now say for example I have a product weighting 10kg and it costs me £30 how would I add this to the forumale to work???????????????????????????????????

Share this post


Link to post
Share on other sites

Now I could be wrong, as you have said it has worked, but I would read this:

1:3.00,2:7.00,3:4:00

 

to be

 

up to 1kg postage is £3

from 1 to 2 kg postage is £7

from 2 to 3 kg postage is £4

 

 

I would put:

1:3.00,2:10.00,3.5:14.00

 

So then you would have:

 

up to 1kg = £3

up to 2kg = £10

up to 3.5kg = £14

 

Like I said though I could be wrong.

 

now say for example I have a product weighting 10kg and it costs me £30 how would I add this to the forumale to work?

 

1:3.00,2:10.00,3.5:14.00,10:30.00

But that would mean anything with a weight falling in between 3.5kg and 10kg would be charged £30.00

Edited by aussieskin

Worse things happen at sea

Share this post


Link to post
Share on other sites
Now I could be wrong, as you have said it has worked, but I would read this:

1:3.00,2:7.00,3:4:00

 

to be

 

up to 1kg postage is £3

from 1 to 2 kg postage is £7

from 2 to 3 kg postage is £4

I would put:

1:3.00,2:10.00,3.5:14.00

 

So then you would have:

 

up to 1kg = £3

up to 2kg = £10

up to 3.5kg = £14

 

Like I said though I could be wrong.

1:3.00,2:10.00,3.5:14.00,10:30.00

But that would mean anything with a weight falling in between 3.5kg and 10kg would be charged £30.00

 

hey aussieskin,

thanks for your reply.

 

Ok I put in the code:

1:3.00,2:10.00,3.5:14.00,10:30.00

 

But when I tested it out, a product weighting at 3.5 showed up on the checkout as:

 

Shipping to United Kingdom : 3.85 Kg £27.00

 

^ How comes!?

 

I thought this (crazy) weight system works like this:

 

i.e. 1kg = £3

3kg = £10

 

so you would put

1:3.00,2:7.00 <-- so its £3+£7!!! This is driving me mad.

 

Any suggestions??

Share this post


Link to post
Share on other sites

yes, it works, and works for zones and it is well easier than weight

 

i have done it in my store by adding in a second and third weight field - so when inserting product info - i can add in three prices - for UK europe and ROW

Share this post


Link to post
Share on other sites
Tare weight, is set on 'zero' ?

 

What is tare weight

Tare weight is the weight of your packaging materials.


The Coopco Underwear Shop

 

If you live to be 100 years of age, that means you have lived for 36,525 days. Don't waste another, there aren't many left.

Share this post


Link to post
Share on other sites
yes, it works, and works for zones and it is well easier than weight

 

i have done it in my store by adding in a second and third weight field - so when inserting product info - i can add in three prices - for UK europe and ROW

 

what!

are you for real!

 

Ok I got a friend to add some shipping contributions to help me with this weight issue, can I use your contribution on my exisiting script? Because I can not remmeber which contributions he added?

 

My client desperatley wants to set indidivdual prices per product, as he does not like the weight system... so what do you suggest i do?

Share this post


Link to post
Share on other sites
Tare weight is the weight of your packaging materials.

 

Is there anyway of setting this to 'zero' with it actually not adding any weight to the final shipping weight

Share this post


Link to post
Share on other sites
hey aussieskin,

thanks for your reply.

 

Ok I put in the code:

1:3.00,2:10.00,3.5:14.00,10:30.00

 

But when I tested it out, a product weighting at 3.5 showed up on the checkout as:

 

Shipping to United Kingdom : 3.85 Kg £27.00

 

^ How comes!?

 

I thought this (crazy) weight system works like this:

 

i.e. 1kg = £3

3kg = £10

 

so you would put

1:3.00,2:7.00 <-- so its £3+£7!!! This is driving me mad.

 

Any suggestions??

It is up to 0-1kg, then 0 to 2kg, then 0 to 3kg, ........

There is no way the table you showed could give £27.00 unless you had your tax class wrong and it discounted the price by 10%. You could also check your order total module in admin to see if the sort order is correct.


The Coopco Underwear Shop

 

If you live to be 100 years of age, that means you have lived for 36,525 days. Don't waste another, there aren't many left.

Share this post


Link to post
Share on other sites
Ok I got a friend to add some shipping contributions to help me with this weight issue, can I use your contribution on my exisiting script? Because I can not remmeber which contributions he added?

 

its only another delivery module - and so you should be able to just add in regardless of existing contributions

Share this post


Link to post
Share on other sites

Ok I put in the code:

1:3.00,2:10.00,3.5:14.00,10:30.00

 

But when I tested it out, a product weighting at 3.5 showed up on the checkout as:

 

Shipping to United Kingdom : 3.85 Kg £27.00

 

this might happen if the default currency is a different one.

So a currency conversion of 10% is making 30*.9 = 27.

 

Just chek Your localization.

 

Thanks,

Satish


Ask/Skype for Free osCommerce value addon/SEO suggestion tips for your site.

 

Check My About US For who am I and what My company does.

Share this post


Link to post
Share on other sites
Ok I put in the code:

1:3.00,2:10.00,3.5:14.00,10:30.00

 

But when I tested it out, a product weighting at 3.5 showed up on the checkout as:

 

Shipping to United Kingdom : 3.85 Kg £27.00

 

this might happen if the default currency is a different one.

So a currency conversion of 10% is making 30*.9 = 27.

 

Just chek Your localization.

 

Thanks,

Satish

 

Hi Satish,

 

I have GB and EURO as my currencies under localization.,

the GB is set at default

 

what should I change?

Im going to give the shipping rate per product a try inabit, i pray it works!

Thanks for your help

Share this post


Link to post
Share on other sites
It is up to 0-1kg, then 0 to 2kg, then 0 to 3kg, ........

There is no way the table you showed could give £27.00 unless you had your tax class wrong and it discounted the price by 10%. You could also check your order total module in admin to see if the sort order is correct.

 

Hi Coopco,

 

I looked under Admin, the Order Total

 

I have shipping on sort 1

subtotal on 2

and total on 3

 

^ although i dont no what that means

Share this post


Link to post
Share on other sites
yes, it works, and works for zones and it is well easier than weight

 

i have done it in my store by adding in a second and third weight field - so when inserting product info - i can add in three prices - for UK europe and ROW

 

Hi Squalid,

 

I used that contribution,

http://www.oscommerce.com/community/contri...ry/search,83462

 

Followed all the steps, and set all the postages per product through admin,

when i browse the product listings all of them are showing up correct.

 

HOWEVER! .. somethings not right, really need help...

When I go to the checkout_shipping.php page it shows this error:

 

Warning: Division by zero in /home/sites/fjronline.com/public_html/includes/modules/shipping/zones.php on line 145

 

^ now in admin, my shipping is still set on ZONE RATE, if I remove it, then on the checkout_shipping.php page the error msg goes, but it does not display the postage charges, it is just blank?and neither does it add to the total on the checkout_confirmation.php

 

what to do, this is real sad.

i hope theres a sollution out there, because the weight system was giving me problems, really want to implement this postage per product...

await your replies

if someone can help me pls!!

Share this post


Link to post
Share on other sites

This is what the zone.php code looks like if any help:

 

<?php
/*

 $Id: zones.php,v 1.20 2003/06/15 19:48:09 thomasamoulton Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

#####################################################
#  MODDED BY: Chaveiro 8-5-2004 on MS2.2
#								chaveiro@catus.net
#  Now you can define zone countries in tax zones.
#  
#  HACKED BY: Gary Teo
#								gaweee@gmail.com
#  Very simply force weights to "First x weight costs $a, every subsequent y weight costs $b
#####################################################

 Released under the GNU General Public License

 USAGE
 By default, the module comes with support for 1 zone.  This can be
 easily changed by editing the line below in the zones constructor 
 that defines $this->num_zones.

 Next, you will want to activate the module by going to the Admin screen,
 clicking on Modules, then clicking on Shipping.  A list of all shipping
 modules should appear.  Click on the green dot next to the one labeled 
 zones.php.  A list of settings will appear to the right.  Click on the
 Edit button. 

 PLEASE NOTE THAT YOU WILL LOSE YOUR CURRENT SHIPPING RATES AND OTHER 
 SETTINGS IF YOU TURN OFF THIS SHIPPING METHOD.  Make sure you keep a 
 backup of your shipping settings somewhere at all times.

 If you want an additional handling charge applied to orders that use this
 method, set the Handling Fee field.

 Next, you will need to define which tax zone are in each zone.  Determining
 this might take some time and effort.  You should group a set of countries
 that has similar shipping charges for the same weight.  For instance, when
 shipping from the US, the countries of Japan, Australia, New Zealand, and 
 Singapore have similar shipping rates. 

 Now you need to set up the shipping rate tables for each zone.  Again,
 some time and effort will go into setting the appropriate rates.
 You prepare certain defined rates in a comma delimited
 list and enter them into the "Zone X Shipping Table" fields where "X" 
 is the zone number.  For example, this might be used for Zone 1:
 3:7.5,4:6.6,6:5.3,7:4.2 means 
 1st 3KG costs $7.50 and
 Next 4KG costs $6.60 and
 Next 6KG costs $5.30 and
 subsequently every 7KG will cost an additional $4.20.
 Hence a 46KG item will cost $40.40


 If you want to be able to ship to any country in the world, you will 
 need to enter every country code into a tax zone. For most
 shops, you will not want to enter every country.  This is often 
 because of too much fraud from certain places.
 Zone 1 is prioritary to zone 2 and so on. If a country is in both zones, first zone
 it apears will be used. If that zone doesn't have mathed weights, next zone matched
 will be used.
 If a country is not listed at any zone, then the module will add a $0.00 shipping charge
 and will indicate that shipping is not available to that destination.  
 PLEASE NOTE THAT THE ORDER CAN STILL BE COMPLETED AND PROCESSED!

 Lastly, there is a limit of 255 characters on each of the Zone
 Shipping Tables. 

*/

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

// class constructor
function zones() {
  $this->code = 'zones';
  $this->title = MODULE_SHIPPING_ZONES_TEXT_TITLE;
  $this->description = MODULE_SHIPPING_ZONES_TEXT_DESCRIPTION;
  $this->sort_order = MODULE_SHIPPING_ZONES_SORT_ORDER;
//	  $this->icon = '';
  $this->icon = DIR_WS_ICONS . 'shipping_ctt.gif';
  $this->tax_class = MODULE_SHIPPING_ZONES_TAX_CLASS;
  $this->enabled = ((MODULE_SHIPPING_ZONES_STATUS == 'True') ? true : false);

  // CUSTOMIZE THIS SETTING FOR THE NUMBER OF ZONES NEEDED
  $this->num_zones = 8;

}

// class methods
function quote($method = '') {
  global $order, $shipping_weight, $shipping_num_boxes;
  $dest_zone = 0;
  $error = false;
  for ($i=1; $i<=$this->num_zones; $i++) {
	$countries_table = constant('MODULE_SHIPPING_ZONES_COUNTRIES_' . $i);
	if ( ($this->enabled == true) && ((int)constant('MODULE_SHIPPING_ZONES_COUNTRIES_' . $i) > 0) ) {
		$check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . $countries_table . "' and (zone_country_id = '" . $order->delivery['country']['id'] . "' or zone_country_id='0') order by zone_id");
		while ($check = tep_db_fetch_array($check_query)) {
		  if ( ($check['zone_id'] < 1) || ($check['zone_id'] == $order->delivery['zone_id']) ) {
			$dest_zone = $i;
			break;
		  }
		}
		if ($dest_zone > 0) {
			$shipping = -1;
			$zones_cost = constant('MODULE_SHIPPING_ZONES_COST_' . $dest_zone);
			$zones_table = split("[:,]" , $zones_cost);
			$size = sizeof($zones_table);

			/*If zone shipping is 3:7.5,4:6.6,6:5.3,7:4.2
			*		This means first 3KG costs $7.50
			*				   next  4KG costs $6.60
			*				   next  6KG costs $5.30
			*		every 7KG after that costs $4.20
			*
			* and if shipping weight is 46 			*/
			if ($shipping_weight) {
				$shipping	= 0;
				$tmpweight	= $shipping_weight;
				$i			= 0;
				for (; $i<$size-2 && $tmpweight > 0; $i+=2) {
					$tmpweight -= floatval($zones_table[$i]);
					$shipping  += floatval($zones_table[$i+1]);
					/*  [Round 0]
					*	remaining tmpweight	= 46 - 3		= 43KG
					*	cost				= 0 + 7.5		= $7.50
					*
					*  [Round 1]
					*	remaining tmpweight	= 43 - 4		= 39KG
					*	cost				= 7.5 + 6.6		= $14.10
					*
					*  [Round 2]
					*	remaining tmpweight	= 39 - 6 		= 33KG
					*	cost				= 14.1 + 5.3	= $19.4 	*/
				}
				if ($tmpweight > 0) {
					/*  [Lastly]
					*	cost				= 19.4 + 4.2*5	= 40.4		*/
					$shipping += ceil($tmpweight/$zones_table[$i]) * $zones_table[$i+1];
				}

				$shipping_method = MODULE_SHIPPING_ZONES_TEXT_WAY . ' ' . $order->delivery['country']['title'] . ' : ' . ($shipping_num_boxes > 1 ? $shipping_num_boxes . " x " : '') . $shipping_weight . ' ' . MODULE_SHIPPING_ZONES_TEXT_UNITS;
			}

			if ($shipping == -1) {
			  $shipping_cost = 0;
			  $shipping_method = MODULE_SHIPPING_ZONES_UNDEFINED_RATE;
			} else {
			  $shipping_cost = ($shipping * $shipping_num_boxes) + constant('MODULE_SHIPPING_ZONES_HANDLING_' . $dest_zone);
			  break;
			}

		}
	}
  }

  if ($dest_zone == 0) {
	$error = true;
  }

  $this->quotes = array('id' => $this->code,
						'module' => MODULE_SHIPPING_ZONES_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_ZONES_INVALID_ZONE;

  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_ZONES_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 Zones Method', 'MODULE_SHIPPING_ZONES_STATUS', 'True', 'Do you want to offer zone rate shipping?', '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_ZONES_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_ZONES_SORT_ORDER', '0', 'Sort order of display.', '6', '0', now())");
  for ($i = 1; $i <= $this->num_zones; $i++) {
//		$default_countries = '';
//		if ($i == 1) {
//		  $default_countries = 'US,CA';
//		}
//		tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Zone " . $i ." Countries', 'MODULE_SHIPPING_ZONES_COUNTRIES_" . $i ."', '" . $default_countries . "', 'Comma separated list of two character ISO country codes that are part of Zone " . $i . ".', '6', '0', 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 ('Zone " . $i ." Countries', 'MODULE_SHIPPING_ZONES_COUNTRIES_" . $i ."', '0', 'Must chose a Tax Zone to enable shipping method for zone" . $i . ".', '6', '0', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())");
//COBRANÇAS CTT: 20:1.95,50:2.06,100:2.16,500:2.79,2000:4.39 ,5000:8.05,10000:28.05

	tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Zone " . $i ." Shipping Table', 'MODULE_SHIPPING_ZONES_COST_" . $i ."', '', 'Shipping rates to Zone " . $i . " destinations. 3:7.5,4:6.6,6:5.3,7:4.2 means the 1st 3KG costs $7.50, the Next 4KG costs $6.60, the Next 6KG costs $5.30 and subsequently every 7KG costs $4.20 for Zone " . $i . " destinations. Hence a 46KG item will cost $40.40', '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 ('Zone " . $i ." Handling Fee', 'MODULE_SHIPPING_ZONES_HANDLING_" . $i."', '0', 'Handling Fee for this shipping zone', '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_ZONES_STATUS', 'MODULE_SHIPPING_ZONES_TAX_CLASS', 'MODULE_SHIPPING_ZONES_SORT_ORDER');

  for ($i=1; $i<=$this->num_zones; $i++) {
	$keys[] = 'MODULE_SHIPPING_ZONES_COUNTRIES_' . $i;
	$keys[] = 'MODULE_SHIPPING_ZONES_COST_' . $i;
	$keys[] = 'MODULE_SHIPPING_ZONES_HANDLING_' . $i;
  }

  return $keys;
}
 }
?>

Share this post


Link to post
Share on other sites
Warning: Division by zero in /home/sites/fjronline.com/public_html/includes/modules/shipping/zones.php on line 145

 

^ now in admin, my shipping is still set on ZONE RATE, if I remove it, then on the checkout_shipping.php page the error msg goes, but it does not display the postage charges, it is just blank?and neither does it add to the total on the checkout_confirmation.php

 

well you dont need the zones.php if using prod rate - so uninstall

 

yes the prod rate will add at checkout

 

 

you can add something in product info that will display the delivery price in the info

Share this post


Link to post
Share on other sites
Hi Satish,

 

I have GB and EURO as my currencies under localization.,

the GB is set at default

 

what should I change?

Im going to give the shipping rate per product a try inabit, i pray it works!

Thanks for your help

 

can You tell me what conversion formula You ahve set for the two.

 

Satish


Ask/Skype for Free osCommerce value addon/SEO suggestion tips for your site.

 

Check My About US For who am I and what My company does.

Share this post


Link to post
Share on other sites
well you dont need the zones.php if using prod rate - so uninstall

 

yes the prod rate will add at checkout

you can add something in product info that will display the delivery price in the info

 

WOW, that is excellent. its all working now. Thanks a bunch.

I have another question, I thort its best to start a new posts, because its straying away from the topic of this post:

http://forums.oscommerce.com/index.php?showtopic=270600

 

If you can pls help me, thanks!

TC (takecare)

Share this post


Link to post
Share on other sites
can You tell me what conversion formula You ahve set for the two.

 

Satish

 

I have implemented shipping rate per product (for my client), but I do want to solve this issue, for those clients who want a weight based system..

So I am working to install the script again, and then will reply back on this post!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×