Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

shipping module on/off depending on weight


Guest

Recommended Posts

Posted

We need the USPS shipping module to only be an option if the total order weight is 1 pound or less.

(other shipping modules we have turned on will remain no matter what)

 

My brain has evidently stopped working because I can't figure out how to make this happen.

 

If anyone could point me in the right direction I would be forever greatful :)

 

 

TIA

-caz

Posted

in your modules/shipping/usps.php file find this:

 

  class usps {
var $code, $title, $description, $icon, $enabled, $countries;

// class constructor
function usps() {
  global $order;

  $this->code = 'usps';
  $this->title = MODULE_SHIPPING_USPS_TEXT_TITLE;
  $this->description = MODULE_SHIPPING_USPS_TEXT_DESCRIPTION;
  $this->sort_order = MODULE_SHIPPING_USPS_SORT_ORDER;
  $this->icon = DIR_WS_ICONS . 'shipping_usps.gif';
  $this->tax_class = MODULE_SHIPPING_USPS_TAX_CLASS;
  $this->enabled = ((MODULE_SHIPPING_USPS_STATUS == 'True') ? true : false);

 

add this right below it

	if (is_object($order)) {

// disable the module if the order weighs more than 1lb
	if ($this->enabled == true) {
		global $cart;
		if ($cart->show_weight() > 1) {
			$this->enabled = false;
		}
	}
}

 

depending on tare weight set in admin, the shipping will be calculated for more than those 1lb

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Posted

You are AWESOME Monika !

 

Thank you Thank you Thank you :D

 

(It worked perfectly)

Posted

I hate to be a mooch, but the tare weight is not actually counted but we would like it to be.

 

(2 items weighing .4 pounds plus .5 tare = 1.3 lbs .. USPS is still displayed .. but 3 items at .4 lbs, the option disappears as expected because the item total is now 1.2 lbs but total weight is 1.7)

 

Is that an easy tweak ?

 

Thanks again.

Posted
I hate to be a mooch, but the tare weight is not actually counted but we would like it to be.

 

(2 items weighing .4 pounds plus .5 tare = 1.3 lbs .. USPS is still displayed .. but 3 items at .4 lbs, the option disappears as expected because the item total is now 1.2 lbs but total weight is 1.7)

 

Is that an easy tweak ?

 

Thanks again.

 

where you have >1 in the new code snippet, make it

 

> (1 - SHIPPING_BOX_WEIGHT)

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Posted

:thumbsup: brilliant !

 

Thanks sooo much !

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...