knifeman Posted October 12, 2007 Share Posted October 12, 2007 Hi all, I am trying to implement the linkpoint payment module on my wholesale site. It works just fine on my retail, but on the other site I have a low order fee module installed. Orders under $50 incur a low order fee. When I try to checkout, the linkpoint module gives an error: SGS-002301 Charge total must be the sum of subtotal, tax, VAT, and shipping. I found a linkpoint mod in the contributions that looks just like mine, but it is under a different name. Included with the mod is a hack to make the 'credit voucher/gift card' module work. Apparently this mod causes the same exact problem as my low order fee mod. I have no idea how to hack the hack so it will work for my low order mod. It looks like it might be fairly simple for someone who knows how to code. I am going to post the code for the hack, and then the code for my low order fee mod. If anyone wants to look them over and see what they can come up with. As I said I am willing to hire this done. Thanks to all...... Simple really, just had to figure out the "PHP" way to do it. Just a couple of edits so I won't include full files. In /catalog/includes/modules/ot_coupon.php: Find lines: if ($od_amount > 0) { $order->info['total'] = $order->info['total'] - $od_amount; Add this line right after: $_SESSION['od_amount'] = $od_amount; In /catalog/includes/modules/ot_subtotal.php: Find lines: function process() { global $order, $currencies; Add right after: $od_amount = $_SESSION['od_amount']; $subtotal = $order->info['subtotal'] - $od_amount; $order->info['subtotal'] = $order->info['subtotal'] - $od_amount; Then, make sure the sort order of the payment lines (via OSCommerce admin site) puts discount before subtotal. Essentially, I just used the global PHP session to make the discount amount available in the standard subtotal routine. There may be more correct ways to do it but it works. <?php /* $Id: ot_loworderfee.php,v 1.11 2003/02/14 06:03:32 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ class ot_loworderfee { var $title, $output; function ot_loworderfee() { $this->code = 'ot_loworderfee'; $this->title = MODULE_ORDER_TOTAL_LOWORDERFEE_TITLE; $this->description = MODULE_ORDER_TOTAL_LOWORDERFEE_DESCRIPTION; $this->enabled = ((MODULE_ORDER_TOTAL_LOWORDERFEE_STATUS == 'true') ? true : false); $this->sort_order = MODULE_ORDER_TOTAL_LOWORDERFEE_SORT_ORDER; $this->output = array(); } function process() { global $order, $currencies; if (MODULE_ORDER_TOTAL_LOWORDERFEE_LOW_ORDER_FEE == 'true') { switch (MODULE_ORDER_TOTAL_LOWORDERFEE_DESTINATION) { case 'national': if ($order->delivery['country_id'] == STORE_COUNTRY) $pass = true; break; case 'international': if ($order->delivery['country_id'] != STORE_COUNTRY) $pass = true; break; case 'both': $pass = true; break; default: $pass = false; break; } if ( ($pass == true) && ( ($order->info['total'] - $order->info['shipping_cost']) < MODULE_ORDER_TOTAL_LOWORDERFEE_ORDER_UNDER) ) { $tax = tep_get_tax_rate(MODULE_ORDER_TOTAL_LOWORDERFEE_TAX_CLASS, $order->delivery['country']['id'], $order->delivery['zone_id']); $tax_description = tep_get_tax_description(MODULE_ORDER_TOTAL_LOWORDERFEE_TAX_CLASS, $order->delivery['country']['id'], $order->delivery['zone_id']); $order->info['tax'] += tep_calculate_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax); $order->info['tax_groups']["$tax_description"] += tep_calculate_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax); $order->info['total'] += MODULE_ORDER_TOTAL_LOWORDERFEE_FEE + tep_calculate_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax); $this->output[] = array('title' => $this->title . ':', 'text' => $currencies->format(tep_add_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax), true, $order->info['currency'], $order->info['currency_value']), 'value' => tep_add_tax(MODULE_ORDER_TOTAL_LOWORDERFEE_FEE, $tax)); } } } function check() { if (!isset($this->_check)) { $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_ORDER_TOTAL_LOWORDERFEE_STATUS'"); $this->_check = tep_db_num_rows($check_query); } return $this->_check; } function keys() { return array('MODULE_ORDER_TOTAL_LOWORDERFEE_STATUS', 'MODULE_ORDER_TOTAL_LOWORDERFEE_SORT_ORDER', 'MODULE_ORDER_TOTAL_LOWORDERFEE_LOW_ORDER_FEE', 'MODULE_ORDER_TOTAL_LOWORDERFEE_ORDER_UNDER', 'MODULE_ORDER_TOTAL_LOWORDERFEE_FEE', 'MODULE_ORDER_TOTAL_LOWORDERFEE_DESTINATION', 'MODULE_ORDER_TOTAL_LOWORDERFEE_TAX_CLASS'); } 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 Low Order Fee', 'MODULE_ORDER_TOTAL_LOWORDERFEE_STATUS', 'true', 'Do you want to display the low order fee?', '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_LOWORDERFEE_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, set_function, date_added) values ('Allow Low Order Fee', 'MODULE_ORDER_TOTAL_LOWORDERFEE_LOW_ORDER_FEE', 'false', 'Do you want to allow low order fees?', '6', '3', '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, use_function, date_added) values ('Order Fee For Orders Under', 'MODULE_ORDER_TOTAL_LOWORDERFEE_ORDER_UNDER', '50', 'Add the low order fee to orders under this amount.', '6', '4', 'currencies->format', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, date_added) values ('Order Fee', 'MODULE_ORDER_TOTAL_LOWORDERFEE_FEE', '5', 'Low order fee.', '6', '5', 'currencies->format', now())"); 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 ('Attach Low Order Fee On Orders Made', 'MODULE_ORDER_TOTAL_LOWORDERFEE_DESTINATION', 'both', 'Attach low order fee for orders sent to the set destination.', '6', '6', 'tep_cfg_select_option(array(\'national\', \'international\', \'both\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Tax Class', 'MODULE_ORDER_TOTAL_LOWORDERFEE_TAX_CLASS', '0', 'Use the following tax class on the low order fee.', '6', '7', 'tep_get_tax_class_title', 'tep_cfg_pull_down_tax_classes(', now())"); } function remove() { tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } } ?> Link to comment Share on other sites More sharing options...
knifeman Posted October 13, 2007 Author Share Posted October 13, 2007 Using the example above, I created these 2 bits of code. $_SESSION['ot_loworderfee'] = $ot_loworderfee; AND $ot_loworderfee = $_SESSION['ot_loworderfee']; $subtotal = $order->info['subtotal'] + $ot_loworderfee; $order->info['subtotal'] = $order->info['subtotal'] + $ot_loworderfee; I put one in the loworderfee.php and the other in ot_subtotal. I tried several different places in the low order file and never got linkpoint to accept the charge. I did manage to get the low order fee added to the total on the screen though. Somehow it made the entire low order fee line disappear from the checkout page. The Total was just $8 higher than the subtotal. I believe I am half way there already. If someone could just give me a nice little push :thumbsup: Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.