Jump to content
Sign in to follow this  
shutiri

Increase Price by 5.5% at the end

Recommended Posts

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 !

Share this post


Link to post
Share on other sites

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


:|: Was this post helpful ? Click the LIKE THIS button :|:

 

See my Profile to learn more about add ons, templates, support plans and custom coding (click here)

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Ahhh I believe I found it..

 

$this->payment_code_2co = 'pm2checkout';

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×