Recommended Posts

We are using the following shipping(canada post) module:

Based on regions.php by Jorge

Based upon zones.php by wilt

with shipping Class :

\$Id: shipping.php,v 1.23 2003/06/29 11:22:05 hpdl Exp \$

It has a bug in it.

when shipping weight exceeds the topmost limit the shipping price that it display is not correct it actually decreases instead of remaining the same as specified for the topmost limit.

for eg: if the shipping limit is 60lbs @ \$51.00, and the user is ordering the products weighing 66lbs the shipping cost that comes out is less than \$51.00 instead of increasing or remaining the same.

Share on other sites

With my store, I set my maximum package weight at 5000 grams, then show table prices up to that level. When a package exceeds 5000 grams, the cart divides the weight into two equal packages, and calculates shipping based on the weight of one package, multiplied by two. (At least I'm pretty sure that's how it works...)

HTH,

Terry

Terry Kluytmans

Contribs Installed: Purchase Without Account (PWA); Big Images, Product Availability, Description in Product Listing, Graphical Infobox, Header Tags Controller, Login Box, Option Type Feature, plus many layout changes & other mods of my own, like:

* If at first you don't succeed, find out if there's a prize for the loser. *

Share on other sites

With my store, I set my maximum package weight at 5000 grams, then show table prices up to that level. When a package exceeds 5000 grams, the cart divides the weight into two equal packages, and calculates shipping based on the weight of one package, multiplied by two. (At least I'm pretty sure that's how it works...)

HTH,

Terry

---package weight = 0.25 (default) value. I dont know whether is it in lbs or in grams. I think its % i guess.

---What do you mean by 'table prices upto that level' and where should i look for it?

Share on other sites

I have my table rates set to ship by weight. So, for example, my international shipping rates table (Air Mail) looks like this:

1:0.00,100:3.00,250:7.00,500:11.00,1000:22.00,2000:34.00,2500:45.00,3000:51.00,3

500:58.00,4000:63.00,4500:70.00,5000:79.00

Surface mail rates for international (which is just a duplication of the first table.php file, renamed to intsurf.php) are set up like this:

1:0.00,100:3.00,250:5.00,500:7.00,1000:11.00,2000:15.00,2500:29.00,3000:32.00,35

00:35.00,4000:40.00,4500:44.00,5000:48.00

My weights are all calculated in grams, so I've specified a maximum package weight of 5000 in the Packaging/Shipping section. If a package weights 6000 grams, the shipping should - if I'm right about how it works - calculate two packages at 3000 grams each for purposes of showing shipping costs.

HTH,

Terry

Terry Kluytmans

Contribs Installed: Purchase Without Account (PWA); Big Images, Product Availability, Description in Product Listing, Graphical Infobox, Header Tags Controller, Login Box, Option Type Feature, plus many layout changes & other mods of my own, like:

* If at first you don't succeed, find out if there's a prize for the loser. *

Share on other sites

I have my store's weight in pounds(lbs). It is not the problem i guess. And my max packaging values is : 30

and tar weight=2

and %age increase is =1

What are your values plz help me this thing is driving me crazy.

Share on other sites

For my international air mail one, I have the following set in Modules -> Shipping:

Enable Table Method: true

Shipping table: as posted above

Table Method: weight

Handling Fee: 0

Tax Class: none

Shipping Zone: international

Sort Order: 8 (I have 20-something table rates running to different zones)

In Admin -> Configuration -> Shipping/Packaging, I have:

Postal Code: self-explanatory

Maximum Package Weight: 5000 (as in grams)

Package Tare Weight: 0 (I account for pkg weight in product weight)

Larger Packages - Percentage Increase: 0

HTH,

Terry

Terry Kluytmans

Contribs Installed: Purchase Without Account (PWA); Big Images, Product Availability, Description in Product Listing, Graphical Infobox, Header Tags Controller, Login Box, Option Type Feature, plus many layout changes & other mods of my own, like:

* If at first you don't succeed, find out if there's a prize for the loser. *

Share on other sites

Thanks for the help

Its is doing the division into multiple boxes but its not multiplying the quoted cost with the number of boxes. Could you please paste your shipping.php(class) code here. That'll be helpful

Thank You

Share on other sites

I'm using duplicated versions of table.php to handle my shipping methods, so the code is likely not the same as on province.php. (I did start out using province.php, but wanted better shipping descriptions than what it could offer, so switched to multiple table.php files instead.)

In any event, here's my code from /catalog/includes/classes/shipping.php, which I presume is what you want:

```<?php
/*
\$Id: shipping.php,v 1.23 2003/06/29 11:22:05 hpdl Exp \$

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

Released under the GNU General Public License
*/

class shipping {
var \$modules;

// class constructor
function shipping(\$module = '') {
global \$language, \$PHP_SELF;

if (defined('MODULE_SHIPPING_INSTALLED') && tep_not_null(MODULE_SHIPPING_INSTALLED)) {
\$this->modules = explode(';', MODULE_SHIPPING_INSTALLED);

\$include_modules = array();

if ( (tep_not_null(\$module)) && (in_array(substr(\$module['id'], 0, strpos(\$module['id'], '_')) . '.' . substr(\$PHP_SELF, (strrpos(\$PHP_SELF, '.')+1)), \$this->modules)) ) {
\$include_modules[] = array('class' => substr(\$module['id'], 0, strpos(\$module['id'], '_')), 'file' => substr(\$module['id'], 0, strpos(\$module['id'], '_')) . '.' . substr(\$PHP_SELF, (strrpos(\$PHP_SELF, '.')+1)));
} else {
reset(\$this->modules);
while (list(, \$value) = each(\$this->modules)) {
\$class = substr(\$value, 0, strrpos(\$value, '.'));
\$include_modules[] = array('class' => \$class, 'file' => \$value);
}
}

for (\$i=0, \$n=sizeof(\$include_modules); \$i<\$n; \$i++) {
include(DIR_WS_LANGUAGES . \$language . '/modules/shipping/' . \$include_modules[\$i]['file']);
include(DIR_WS_MODULES . 'shipping/' . \$include_modules[\$i]['file']);

\$GLOBALS[\$include_modules[\$i]['class']] = new \$include_modules[\$i]['class'];
}
}
}

function quote(\$method = '', \$module = '') {
global \$total_weight, \$shipping_weight, \$shipping_quoted, \$shipping_num_boxes;

\$quotes_array = array();

if (is_array(\$this->modules)) {
\$shipping_quoted = '';
\$shipping_num_boxes = 1;
\$shipping_weight = \$total_weight;

\$shipping_weight = \$shipping_weight+SHIPPING_BOX_WEIGHT;
} else {
}

if (\$shipping_weight > SHIPPING_MAX_WEIGHT) { // Split into many boxes
\$shipping_num_boxes = ceil(\$shipping_weight/SHIPPING_MAX_WEIGHT);
\$shipping_weight = \$shipping_weight/\$shipping_num_boxes;
}

\$include_quotes = array();

reset(\$this->modules);
while (list(, \$value) = each(\$this->modules)) {
\$class = substr(\$value, 0, strrpos(\$value, '.'));
if (tep_not_null(\$module)) {
if ( (\$module == \$class) && (\$GLOBALS[\$class]->enabled) ) {
\$include_quotes[] = \$class;
}
} elseif (\$GLOBALS[\$class]->enabled) {
\$include_quotes[] = \$class;
}
}

\$size = sizeof(\$include_quotes);
for (\$i=0; \$i<\$size; \$i++) {
\$quotes = \$GLOBALS[\$include_quotes[\$i]]->quote(\$method);
if (is_array(\$quotes)) \$quotes_array[] = \$quotes;
}
}

return \$quotes_array;
}

function cheapest() {
if (is_array(\$this->modules)) {
\$rates = array();

reset(\$this->modules);
while (list(, \$value) = each(\$this->modules)) {
\$class = substr(\$value, 0, strrpos(\$value, '.'));
if (\$GLOBALS[\$class]->enabled) {
\$quotes = \$GLOBALS[\$class]->quotes;
for (\$i=0, \$n=sizeof(\$quotes['methods']); \$i<\$n; \$i++) {
if (isset(\$quotes['methods'][\$i]['cost']) && tep_not_null(\$quotes['methods'][\$i]['cost'])) {
\$rates[] = array('id' => \$quotes['id'] . '_' . \$quotes['methods'][\$i]['id'],
'title' => \$quotes['module'],
'cost' => \$quotes['methods'][\$i]['cost']);
}
}
}
}

\$cheapest = false;
for (\$i=0, \$n=sizeof(\$rates); \$i<\$n; \$i++) {
if (is_array(\$cheapest)) {
if (\$rates[\$i]['cost'] < \$cheapest['cost']) {
\$cheapest = \$rates[\$i];
}
} else {
\$cheapest = \$rates[\$i];
}
}

return \$cheapest;
}
}
}
?>```

HTH,

Terry

Terry Kluytmans

Contribs Installed: Purchase Without Account (PWA); Big Images, Product Availability, Description in Product Listing, Graphical Infobox, Header Tags Controller, Login Box, Option Type Feature, plus many layout changes & other mods of my own, like:

* If at first you don't succeed, find out if there's a prize for the loser. *

Share on other sites

yes, I am using province.php but i dont know why it is not multiplying the shipping cost with number of boxes. It is creating the number of boxes though.

I have pretty much the same code for shipping class

Thanks anyways for the code Appreciate it. Is there other way to figure it out.

In shipping.php(class) theres a function quote() in which they r using a variable \$shipping_quoted and is intialized to ' ' and not being used afterwards any clue why..?

TC

Sukh

Share on other sites

Sorry, Sukh -- I have no idea. (A programmer I am definitely NOT!)

Terry

Terry Kluytmans

Contribs Installed: Purchase Without Account (PWA); Big Images, Product Availability, Description in Product Listing, Graphical Infobox, Header Tags Controller, Login Box, Option Type Feature, plus many layout changes & other mods of my own, like:

* If at first you don't succeed, find out if there's a prize for the loser. *

Share on other sites

Anyways Terry Thank you very much for your help Thanks a lot man

Create an account

Register a new account