Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Recommended Posts

Posted

Hello,

 

I'd like to add the 5.5% that 2CO charges me per transaction at the end of the payment process. Is that possible?

 

Further Explanation:

If a customer buys a products that cost $100, 2CO will charge me $5.5

I'd like to have several payment options, but if the customers chooses 2CO, he would have to pay $105.5 for that order, instead of $100 (with a disclaimer at the end of the payment process of course, before the customer moves forward with that payment).

 

Is that possible ?

 

Thx !

Posted

Shutiri,

 

There currently isn't a 'fee' contribution for 2C0, however there is one for the PayPal Fee which you might be able to use as a reference to create one for the 2C0 payment gateway.

 

 

 

Chris

  • 1 year later...
Posted

Just write a new order totals module then enable it in the correct order in admin.

Posted (edited)

Here you go: -

 

Save this as file catalog/includes/modules/order_total/ot_2co.php

 

<?php
 class ot_2co {
var $title, $output;

function ot_2co() {
  $this->code = 'ot_2co';
  $this->title = MODULE_ORDER_TOTAL_2CO_TITLE;
  $this->description = MODULE_ORDER_TOTAL_2CO_DESCRIPTION;
  $this->enabled = ( (MODULE_ORDER_TOTAL_2CO_STATUS == 'true') ? true : false);
  $this->sort_order = MODULE_ORDER_TOTAL_2CO_SORT_ORDER;
  // 2co charge percentage
  $this->charge_percent_2co = 5.5;
  // The EXACT name of the payment module code e.g. $this->code = '2co'; in the payment class file
  $this->payment_code_2co = '2co';
  $this->output = array();
}

function process() {
  global $order, $currencies, $payment;
  if ( ( $payment != $this->payment_code_2co ) ) return;
  $percentage = $order->info['total'] / 100 * $this->charge_percent_2co;
  $order->info['total'] = ( $order->info['total'] + $percentage );
  $this->output[] = array('title' => $this->title . ':',
						  'text' => $currencies->format($percentage, true, $order->info['currency'], $order->info['currency_value']),
						  'value' => $percentage);
}

function check() {
  if (!isset($this->_check)) {
	$check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_ORDER_TOTAL_2CO_STATUS'");
	$this->_check = tep_db_num_rows($check_query);
  }

  return $this->_check;
}

function keys() {
  return array('MODULE_ORDER_TOTAL_2CO_STATUS', 'MODULE_ORDER_TOTAL_2CO_SORT_ORDER');
}

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 ('Display 2CO charge', 'MODULE_ORDER_TOTAL_2CO_STATUS', 'true', 'Do you want to display the 2co charge?', '6', '1','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, date_added) values ('Sort Order', 'MODULE_ORDER_TOTAL_2CO_SORT_ORDER', '1', 'Sort order of display.', '6', '2', now())");
}

function remove() {
  tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
}
 }
?>

 

Then the following as catalog/includes/languages/english/modules/order_total/ot_2co.php

 

<?php
 define('MODULE_ORDER_TOTAL_2CO_TITLE', '2CO Charge');
 define('MODULE_ORDER_TOTAL_2CO_DESCRIPTION', 'Additional charge by 2CO');
?>

 

Now . .with the first file see ( line 14 ):

 

	  $this->payment_code_2co = '2co';

 

I haven't the foggiest idea what the real code is for this payment module so guessed one up.

 

Check the payment class file for the correct code and change the file before attempting to use.

 

Go to admin>Modules>Order Total install the module and set the sort order before tax if you want the percentage added before tax and after for the opposite.

 

This is thoroughly untested as I had never heard of 2co but it looks ok :)

Edited by FWR Media
Posted

Ahhh I believe I found it..

 

$this->payment_code_2co = 'pm2checkout';

Posted (edited)

So the order_total module file should be ..

 

<?php
 class ot_2co {
   var $title, $output, $charge_percent_2co, $payment_code_2co;

   function ot_2co() {
  $this->code = 'ot_2co';
  $this->title = MODULE_ORDER_TOTAL_2CO_TITLE;
  $this->description = MODULE_ORDER_TOTAL_2CO_DESCRIPTION;
  $this->enabled = ( (MODULE_ORDER_TOTAL_2CO_STATUS == 'true') ? true : false);
  $this->sort_order = MODULE_ORDER_TOTAL_2CO_SORT_ORDER;
  // 2co charge percentage
  $this->charge_percent_2co = 5.5;
  // The EXACT name of the payment module code e.g. $this->code = '2co'; in the payment class file
  $this->payment_code_2co = 'pm2checkout';
  $this->output = array();
   }

   function process() {
  global $order, $currencies, $payment;
  if ( ( $payment != $this->payment_code_2co ) ) return;
  $percentage = $order->info['total'] / 100 * $this->charge_percent_2co;
  $order->info['total'] = ( $order->info['total'] + $percentage );
  $this->output[] = array('title' => $this->title . ':',
						  'text' => $currencies->format($percentage, true, $order->info['currency'], $order->info['currency_value']),
						  'value' => $percentage);
   }

   function check() {
  if (!isset($this->_check)) {
    $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_ORDER_TOTAL_2CO_STATUS'");
    $this->_check = tep_db_num_rows($check_query);
  }

  return $this->_check;
   }

   function keys() {
  return array('MODULE_ORDER_TOTAL_2CO_STATUS', 'MODULE_ORDER_TOTAL_2CO_SORT_ORDER');
   }

   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 ('Display 2CO charge', 'MODULE_ORDER_TOTAL_2CO_STATUS', 'true', 'Do you want to display the 2co charge?', '6', '1','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, date_added) values ('Sort Order', 'MODULE_ORDER_TOTAL_2CO_SORT_ORDER', '1', 'Sort order of display.', '6', '2', now())");
   }

   function remove() {
  tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
   }
 }
?>

Edited by FWR Media

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

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