Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Please Help


SSingh

Recommended Posts

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

 

$Id: province.php, v 1.0 25/07/2003 [email protected] $

 

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.

 

Anyone know how to fix it. Please help urgent help will be appreciated and Thanks in advance

Link to comment
Share on other sites

In your Admin -> Store Configuration -> Shipping/Packaging section, what does your maximum package weight show?

 

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:

 

Add order total to checkout_shipment

Add order total to checkout_payment

Add radio buttons at checkout_shipping (for backorder options, etc.)

Duplicate Table Rate Shipping Module

Better Product Review Flow

 

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

Link to comment
Share on other sites

In your Admin -> Store Configuration -> Shipping/Packaging section, what does your maximum package weight show?

 

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?

Link to comment
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:

 

Add order total to checkout_shipment

Add order total to checkout_payment

Add radio buttons at checkout_shipping (for backorder options, etc.)

Duplicate Table Rate Shipping Module

Better Product Review Flow

 

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

Link to comment
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.

Link to comment
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:

 

Country of Origin: Canada

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:

 

Add order total to checkout_shipment

Add order total to checkout_payment

Add radio buttons at checkout_shipping (for backorder options, etc.)

Duplicate Table Rate Shipping Module

Better Product Review Flow

 

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

Link to comment
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

Link to comment
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

 Copyright (c) 2003 osCommerce

 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;

       if (SHIPPING_BOX_WEIGHT >= $shipping_weight*SHIPPING_BOX_PADDING/100) {
         $shipping_weight = $shipping_weight+SHIPPING_BOX_WEIGHT;
       } else {
         $shipping_weight = $shipping_weight + ($shipping_weight*SHIPPING_BOX_PADDING/100);
       }

       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:

 

Add order total to checkout_shipment

Add order total to checkout_payment

Add radio buttons at checkout_shipping (for backorder options, etc.)

Duplicate Table Rate Shipping Module

Better Product Review Flow

 

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

Link to comment
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

Link to comment
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:

 

Add order total to checkout_shipment

Add order total to checkout_payment

Add radio buttons at checkout_shipping (for backorder options, etc.)

Duplicate Table Rate Shipping Module

Better Product Review Flow

 

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

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...