psleman Posted August 24, 2017 Share Posted August 24, 2017 I am trying to display an PayPal Fee on my checkout confirmation page and I am having a hard time getting it to display. I have created an ot_paypal_fee.php file with the code below. Am I missing something? Thank you for your help. ot_paypal_fee.php ot_paypal_fee (2).php Link to comment Share on other sites More sharing options...
Dan Cole Posted August 24, 2017 Share Posted August 24, 2017 I don't know if everyone will have the same problem but I can't access those files. Dan Need help? See this thread and provide the information requested. Is your version of osC up to date? You'll find the latest osC community version (CE Phoenix) here. Link to comment Share on other sites More sharing options...
psleman Posted August 24, 2017 Author Share Posted August 24, 2017 Here is the code: class ot_paypal_fee { var $title, $output; function ot_paypal_fee() { $this->code = 'ot_paypal_fee'; $this->title = MODULE_ORDER_TOTAL_PAYPAL_TITLE; $this->description = MODULE_ORDER_TOTAL_PAYPAL_DESCRIPTION; $this->enabled = ((MODULE_ORDER_TOTAL_PAYPAL_STATUS == 'true') ? true : false); $this->sort_order = MODULE_ORDER_TOTAL_PAYPAL_SORT_ORDER; $this->output = array(); } function process() { global $order, $currencies, $paypal_fee; if (MODULE_ORDER_TOTAL_PAYPAL_STATUS == 'true') { //check if payment method is paypal. If yes, add fee. if ($GLOBALS['payment'] == 'paypal') { $paypal_fee = tep_round(((MODULE_ORDER_TOTAL_PAYPAL_FEE/100) * $order->info['total']), $currencies->currencies[DEFAULT_CURRENCY]['decimal_places']); $order->info['total'] += $paypal_fee; $this->output[] = array('title' => $this->title . ' (' . MODULE_ORDER_TOTAL_PAYPAL_FEE . '%):', 'text' => $currencies->format($paypal_fee, true, $order->info['currency'], $order->info['currency_value']), 'value' => $paypal_fee); } } } function check() { if (!isset($this->_check)) { $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_ORDER_TOTAL_PAYPAL_STATUS'"); $this->_check = tep_db_num_rows($check_query); } return $this->_check; } function keys() { return array('MODULE_ORDER_TOTAL_PAYPAL_STATUS', 'MODULE_ORDER_TOTAL_PAYPAL_SORT_ORDER', 'MODULE_ORDER_TOTAL_PAYPAL_FEE'); } 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 PAYPAL FEE', 'MODULE_ORDER_TOTAL_PAYPAL_STATUS', 'true', 'Do you want this module to display?', '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_PAYPAL_SORT_ORDER', '4', 'Sort order of display.', '6', '2', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('PAYPAL Fee (%)', 'MODULE_ORDER_TOTAL_PAYPAL_FEE', '1', 'Your PayPal fee in percent (%)', '6', '3', now())"); } function remove() { $keys = ''; $keys_array = $this->keys(); $keys_size = sizeof($keys_array); for ($i=0; $i<$keys_size; $i++) { $keys .= "'" . $keys_array[$i] . "',"; } $keys = substr($keys, 0, -1); tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in (" . $keys . ")"); } } ?> Link to comment Share on other sites More sharing options...
psleman Posted August 24, 2017 Author Share Posted August 24, 2017 Also: define('MODULE_ORDER_TOTAL_PAYPAL_TITLE', 'Paypal Fee'); define('MODULE_ORDER_TOTAL_PAYPAL_DESCRIPTION', 'Paypal Fee'); ?> Link to comment Share on other sites More sharing options...
Dan Cole Posted August 25, 2017 Share Posted August 25, 2017 Paul I assume you've installed it? What is happening or not happening as the case might be. At a glance your approach looks okay. Are you able to output anything at all? Dan Need help? See this thread and provide the information requested. Is your version of osC up to date? You'll find the latest osC community version (CE Phoenix) here. Link to comment Share on other sites More sharing options...
MrPhil Posted August 25, 2017 Share Posted August 25, 2017 Be careful there. If the purpose of this exercise is to charge extra for customers using PayPal (to cover the fee), you should carefully read their Terms of Service. I know they used to forbid charging extra; I don't know if they still do. Link to comment Share on other sites More sharing options...
psleman Posted August 25, 2017 Author Share Posted August 25, 2017 12 hours ago, Dan Cole said: Paul I assume you've installed it? What is happening or not happening as the case might be. At a glance your approach looks okay. Are you able to output anything at all? Dan Yes I have uploaded the files. I am wondering if there is something else I need to do to another file to actually get it to display on the website. Thank you very much for your assistance. Link to comment Share on other sites More sharing options...
Dan Cole Posted August 25, 2017 Share Posted August 25, 2017 Not uploaded but installed it....admin -> modules -> order total -> install tab -> select etc. Dan Need help? See this thread and provide the information requested. Is your version of osC up to date? You'll find the latest osC community version (CE Phoenix) here. Link to comment Share on other sites More sharing options...
psleman Posted August 25, 2017 Author Share Posted August 25, 2017 5 minutes ago, Dan Cole said: Not uploaded but installed it....admin -> modules -> order total -> install tab -> select etc. Dan I am not sure what you mean by installed it? Link to comment Share on other sites More sharing options...
Dan Cole Posted August 25, 2017 Share Posted August 25, 2017 When you add a module you need to install it so that the configuration variables are added to the database configuration file....go to admin and click on the tabs indicated below.... .admin -> modules -> order total -> install tab -> select etc. Dan Need help? See this thread and provide the information requested. Is your version of osC up to date? You'll find the latest osC community version (CE Phoenix) here. Link to comment Share on other sites More sharing options...
psleman Posted August 25, 2017 Author Share Posted August 25, 2017 18 minutes ago, Dan Cole said: When you add a module you need to install it so that the configuration variables are added to the database configuration file....go to admin and click on the tabs indicated below.... .admin -> modules -> order total -> install tab -> select etc. Dan Yes I have installed the module. Link to comment Share on other sites More sharing options...
Dan Cole Posted August 25, 2017 Share Posted August 25, 2017 Okay....so can I assume that you're not seeing anything when you visit your checkout confirmation page? Did you try adding an echo or print_R statement after your globals to see if it's being loaded? If that works you can then test your if statements to see what is or isn't working the way you intend. Dan Need help? See this thread and provide the information requested. Is your version of osC up to date? You'll find the latest osC community version (CE Phoenix) here. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.