Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Adding a Handling Fee as a Percentage


thomas1000

Recommended Posts

Posted

Sorry if this has been asked before, I couldn't find it if it has.

 

Is it possible to add a handling fee, on all orders, that is a percentage? Is there a contribution that does this? All the handling charges I see use flat rates instead of percentages. Any help or a direction to look would be appreciated. Thanks.

 

Thomas

Posted

in the catalog\include\modules\flat.php change this:

 

// class methods
function quote($method = '') {
  global $order;

 

to this

// class methods
function quote($method = '') {
  global $order, $cart;
  $cost = $cart->show_total();

 

further down change

 

	  $this->quotes = array('id' => $this->code,
						'module' => MODULE_SHIPPING_FLAT_TEXT_TITLE,
						'methods' => array(array('id' => $this->code,
												 'title' => MODULE_SHIPPING_FLAT_TEXT_WAY,
												 'cost' => MODULE_SHIPPING_FLAT_COST)));

 

to

 

	  $this->quotes = array('id' => $this->code,
						'module' => MODULE_SHIPPING_FLAT_TEXT_TITLE,
						'methods' => array(array('id' => $this->code,
												 'title' => MODULE_SHIPPING_FLAT_TEXT_WAY,
												 'cost' => ($cost*MODULE_SHIPPING_FLAT_COST)/100 )));

Posted

enigma1,

 

Thanks but I think I left out some important information.

 

We need to offer shipping as DHL or USPS. The only flat.php file I found was under shipping and looks like it becomes a shipping option instead of an addition to the order. Is there another variable or file that I would be able to add the handling percentage?

 

One idea I have had is wondering about following your suggestion but incorporating it into the DHL and USPS modules. This way taking their dollar amount handling charge and converting it to a percentage. Do you think this would work?

 

Thank you again.

 

Thomas

 

 

in the catalog\include\modules\flat.php change this:

 

// class methods
function quote($method = '') {
  global $order;

 

to this

// class methods
function quote($method = '') {
  global $order, $cart;
  $cost = $cart->show_total();

 

further down change

 

	  $this->quotes = array('id' => $this->code,
						'module' => MODULE_SHIPPING_FLAT_TEXT_TITLE,
						'methods' => array(array('id' => $this->code,
												 'title' => MODULE_SHIPPING_FLAT_TEXT_WAY,
												 'cost' => MODULE_SHIPPING_FLAT_COST)));

 

to

 

	  $this->quotes = array('id' => $this->code,
						'module' => MODULE_SHIPPING_FLAT_TEXT_TITLE,
						'methods' => array(array('id' => $this->code,
												 'title' => MODULE_SHIPPING_FLAT_TEXT_WAY,
												 'cost' => ($cost*MODULE_SHIPPING_FLAT_COST)/100 )));

Posted

if the shipping module support a separate handling (if it doesn't you need to add it) you do the same thing and make it a percentage of the total. It's fairly simple.

Archived

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

×
×
  • Create New...