Low Order Fee - Oscommerce
07-13-2010, 03:34 PM
|
Low Order Fee - Oscommerce
|
Posts: 17
|
Hi
Hope someone can help
I have been trying to find a way of giving free shipping when they get to a certain amount, easy enough to do, except that as I use couriers (my products are heavy) different areas of the uk are subject to surcharges, so the free shipping minimum amount doesnt work.
I therefore thought that it would be easier to subtract the £6.95 off the end so that the surcharged countries still pay the extra - but its still discounted.
I have been looking at the low order fee, which would be perfect if it was the other way round
example - at the moment it places a fee if the amount isnt enough, how can i change it to minus a fee if the amount is over x amount
at the moment it shows
Order Fee For Orders Under
£50.00
Order Fee
£5.00
i would like it to be
Order Fee For Orders OVER
£50.00
Order Fee
-£5.00
here is the code
PHP Code:
<?php /* $Id: ot_loworderfee.php 1739 2007-12-20 00:52:16Z hpdl $
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()) . "')"); } } ?>
|
|
|
|
07-13-2010, 07:43 PM
|
Re: Low Order Fee - Oscommerce
|
Posts: 2,918
Name: Keith Marshall
Location: Connecticut
|
Are you wanting the order total to show that it was added, then subtracted?
i.e.
Subtotal: £100.00
Order Fee: £5.00
Order Fee (for orders over 50): -£5.00
Total: £100.00
__________________
<mgraphic /> - I don't have a solution but I admire the problem.
|
|
|
|
07-14-2010, 03:42 AM
|
Re: Low Order Fee - Oscommerce
|
Posts: 17
|
Yes
I do - I just want it to go the opposite way
so instead of adding the order fee - it subtracts it
this should be so simple - but i havn't got a clue !
|
|
|
|
07-14-2010, 07:31 AM
|
Re: Low Order Fee - Oscommerce
|
Posts: 17
|
dont worry - i have figured it out < - >
|
|
|
|
07-14-2010, 09:59 AM
|
Re: Low Order Fee - Oscommerce
|
Posts: 2,918
Name: Keith Marshall
Location: Connecticut
|
I do a lot of work in ZenCart, so when you modify the value for $order->info['total'] it will be reflected on the total amount.
__________________
<mgraphic /> - I don't have a solution but I admire the problem.
|
|
|
|
|
« Reply to Low Order Fee - Oscommerce
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|