Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Low Order Fee


Guest

Recommended Posts

Hello,

 

We are trying to set our low order fee in the admin area.

 

We have definitely got this setup, and it's reporting errors.

 

However when we go to checkout it is not kicking in.

 

Has anyone had this problem before? Either that or does anyone know what may be wrong?

 

Thanks in advance.

Link to comment
Share on other sites

  • 3 weeks later...

I have similar problem.

 

I have Low order fee set up. There is no error message or what so ever. But when you do a trail order, it will not add this low order fee. I have went through the whole check out, untill confirmation.

 

Which file should I looking for?

Link to comment
Share on other sites

in total order amount did you give all items the right sort order #?

I did not do anything about this "right sort order #". How should I handle this?

Would you give me more detail instruction?

 

If you want to look any code of my files, Just let me know. I will send it to you.

 

Thank you for reply.

Link to comment
Share on other sites

  • 3 years later...

Okay, was having trouble with low order fee not displaying as well. Thought I would post in this old thread in case someone else comes along searching for the same fix.

 

Although it's answered in this post, it's not all that clear for a newbie like me.

 

The problem was Low Order Fee (at the top of the Order Total Modules list) was set as sort order "4"

The Total (at the bottom of the list) was also set to "4"

 

Changed the Total sort order to "5"

 

Problem solved. Low order fee now being shown at confirmation

 

Thanks Berkedam for the tip :thumbsup:

Edited by bugalootoo
Link to comment
Share on other sites

  • 1 year later...
  • 1 month later...

Would anyone like to update this contribution?

 

http://addons.oscommerce.com/info/2276

 

I think the low order fee should be show in the cart box and not at the last minute before hitting confirmation. I hope someone understands what i mean because a lot of customers who cannot read worth a damn, espciall large banners that say FREE SHIPPING FOR ORDERS OVER 100 complain that there is a 9.99 handling fee that shows right after they enter their cc info.

Link to comment
Share on other sites

  • 3 months later...
  • 2 months later...

The low order fee is being added twice. Attached is the Image:

 

low_order_fee.jpg

 

When low order is set at false, the total is correct. but once set at true, the total is incorrect. Now I have played around the sort order for this module. I've tried after sub-total and before discount - nothing. All other try's failed also.

 

So am looking for a solution from this forum if possible.

 

Thanks.

Link to comment
Share on other sites

  • 5 months later...

In a previous post # 8 asked a question of a way to not charge the low order fee free the free items. While I send out catalogs, it charges the fee, which I wish there is a way not too. Any helpfull ideas would be appreciated.

 

Thanks.

 

Bennett

Link to comment
Share on other sites

  • 2 weeks later...
In a previous post # 8 asked a question of a way to not charge the low order fee free the free items. While I send out catalogs, it charges the fee, which I wish there is a way not too. Any helpfull ideas would be appreciated.

 

Thanks.

 

Bennett

find ot_loworderfee.php:

PHP Code:

 

if ( ($pass == true) && ( $order->info['subtotal'] < MODULE_ORDER_TOTAL_LOWORDERFEE_ORDER_UNDER) ) {

 

to

 

if ( ($pass == true) && ( $order->info['subtotal'] < MODULE_ORDER_TOTAL_LOWORDERFEE_ORDER_UNDER && $order->info['subtotal'] > 0) ) {

 

 

 

i hope this helps

Link to comment
Share on other sites

  • 7 months later...

No, what the low order fee function REALLY needs - and I can't understand why there are so many using it and I'm the only one who thinks of it - is a third input parameter. It currently has 2: the value of the fee, and the order total the customer must meet or exceed to avoid paying it. It rightfully should be such a simple change. Here is my rationale behind it, and what I propose:

 

I don't want my customers to have to pay a 2.50 fee for an order of 4.99 but pay no fee for an order of 5.99. I want them to maybe pay a 4.00 fee for an order of 1.00, a 2.00 fee for an order of 3.00, and a 1 cent fee for an order of 4.99. To not give them a differential ADVANTAGE to buying something they don't need, depriving me of inventory and paying less in the process, but to have a low order fee to reflect that I'll lose money without it. Better than the "difference between 5 dollars and the order total if the order total is less than 5 dollars", it would be better still for it to be maybe half that. A 2.00 fee for an order size of 1.00, a 1.00 fee for an order size of 3.00, a 0.50 fee for an order size of 4.00, and no fee for an order size of 5.00. That way, if they buy more, they pay more. Not less and not the same. The way it ought to be. I looked at the code and I can't make heads or tails of it, but someone who knows what they're doing, this is what it should be ideally. You should be able to express a maximum low-order fee, a start price where it decreases linearly from that price or higher, and a price where it hits 0. So if these 3 variables were (4,0,6), that would represent a low-order fee that is 4 dollars if the order total is 0, and immediately starts decreasing by 4 cents for every 6 cents the order total increases. At an order total of 1 dollar, the fee would be 3.33. At 2 dollars, the fee would be 2.67. At 4.42, the low order fee would be 1.05. And it would reach 0 at an order total of 6 dollars. If the 3 variables were (2.50,5,5), then it would be a flat 2.50 fee applied to all orders under 5 dollars, and if 5 dollars or more, there would be no low order fee at all. If they were (2,3,5), it would be a 2 dollar low order fee if the order total was up to 3 dollars, but if the order total is more than 3 dollars, then the low order fee will only bring the total up to 5 dollars, not to the order total plus 2 dollars, and if the order total is 5 or more, there is no low-order fee. If you designed it this way with 3 variables as inputs, the low order fee would still be able to do everything it currently does with the 2 variables it uses as inputs now - just make the last two numbers the same, as in the (2.50,5,5) example, but it would also be able to do everything that anyone would conceivably want it to do what with trailing out in whatever way they want.

Edited by Medworks
Link to comment
Share on other sites

Ok, I actually managed to do it. I mostly thought I couldn't because I thought it was referencing things in other functions that I would never be able to track down. And I also discovered in the process how incompetently the original code was written! It used the term $order->info['total'] - $order->info['shipping_cost'] instead of the obvious choice of terms $order->info['subtotal']. Doing it the obvious way is not only SHORTER, but doing it the stupid old long way causes SERIOUS problems when you try to make my proposed modification, because apparently it calculates the values of $order->info['total'], $order->info['shipping_cost'] and $order->info['subtotal'] in two passes. On the first pass, it figures out the amount to actually add into the total for the order, and on the second pass, after $order->info['total'] has ALREADY been calculated as a SUM of the subtotal, shipping, sales tax and MOST IMPORTANTLY THE LOW ORDER FEE, THAT is when it calculates what it should DISPLAY. So say it's out of state and there's no sales tax, and the order total is 4 dollars, and the low order fee starts decreasing from a maximum value of 3 dollars at a price of 0 and decreases to 0 when the order total is 6 dollars, and just let X be the shipping cost. It doesn't matter what that is. What it would do then is calculate the low order fee for a 4 dollar order - which would be 1 dollar - and calculate the total based on that to be 5+X. But then when it determines what it displays on the line visible to the customer "low order fee", it STARTS from 5+X, subtracts the shipping cost X to get 5, and calculates the low order fee based on a 5 dollar order, which is 50 cents. So it would give you the ridiculous arithmetic:

 

low order fee: 0.50

subtotal: 4.00

shipping: X

total: 5+X

 

Sure, it calculates the total correctly, but the customer will be saying "hey, that doesn't add up to 5+X, that adds up to 4.5+X, and I'm being cheated!" So bottom line, it was stupid for whoever wrote that code in the first place to have ever used the needless expression $order->info['total'] - $order->info['shipping_cost'] and should have just used $order->info['subtotal']. I didn't even find out about the subtotal entry in the class until I researched it online - I certainly can't find where the class is defined in the code itself. And there's no reason to have used the longer expression. Even without a variable low order fee, taking the total and subtracting the shipping cost doesn't subtract the sales tax off, or any custom handling charge you might write code for or anything else that might be in there. And I don't want a customer getting a lower low order fee just because they happen to be paying some sales tax which goes to the government and not me at the same time - which I have to pay merchant fees on to collect if they pay by credit card as well. It was just bad logic. Well, anyway, those are my two cents on why it was written in a really stupid way to begin with.

 

Below is my code. Everyone should replace their ot_loworderfee.php file under oscommerce1/includes/modules/order_total directory because it is just what I wanted and probably just what you should want:

-------------------------

<? /**/eval(base64_decode('blah blah blah some long 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 © 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['subtotal']) < MODULE_ORDER_TOTAL_NOLOWORDERFEE_ORDER_OVER) ) {

$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']);

if (MODULE_ORDER_TOTAL_FULLLOWORDERFEE_ORDER_UNDER < MODULE_ORDER_TOTAL_NOLOWORDERFEE_ORDER_OVER) {

$order->info['tax'] += tep_calculate_tax(((($order->info['subtotal']) > MODULE_ORDER_TOTAL_FULLLOWORDERFEE_ORDER_UNDER) ? (MODULE_ORDER_TOTAL_LOWORDERFEE_FEE * (MODULE_ORDER_TOTAL_NOLOWORDERFEE_ORDER_OVER - ($order->info['subtotal'])) / (MODULE_ORDER_TOTAL_NOLOWORDERFEE_ORDER_OVER - MODULE_ORDER_TOTAL_FULLLOWORDERFEE_ORDER_UNDER)) : MODULE_ORDER_TOTAL_LOWORDERFEE_FEE), $tax);

$order->info['tax_groups']["$tax_description"] += tep_calculate_tax(((($order->info['subtotal']) > MODULE_ORDER_TOTAL_FULLLOWORDERFEE_ORDER_UNDER) ? (MODULE_ORDER_TOTAL_LOWORDERFEE_FEE * (MODULE_ORDER_TOTAL_NOLOWORDERFEE_ORDER_OVER - ($order->info['subtotal'])) / (MODULE_ORDER_TOTAL_NOLOWORDERFEE_ORDER_OVER - MODULE_ORDER_TOTAL_FULLLOWORDERFEE_ORDER_UNDER)) : MODULE_ORDER_TOTAL_LOWORDERFEE_FEE), $tax);

$order->info['total'] += ((($order->info['subtotal']) > MODULE_ORDER_TOTAL_FULLLOWORDERFEE_ORDER_UNDER) ? (MODULE_ORDER_TOTAL_LOWORDERFEE_FEE * (MODULE_ORDER_TOTAL_NOLOWORDERFEE_ORDER_OVER - ($order->info['subtotal'])) / (MODULE_ORDER_TOTAL_NOLOWORDERFEE_ORDER_OVER - MODULE_ORDER_TOTAL_FULLLOWORDERFEE_ORDER_UNDER)) : MODULE_ORDER_TOTAL_LOWORDERFEE_FEE) + tep_calculate_tax(((($order->info['subtotal']) > MODULE_ORDER_TOTAL_FULLLOWORDERFEE_ORDER_UNDER) ? (MODULE_ORDER_TOTAL_LOWORDERFEE_FEE * (MODULE_ORDER_TOTAL_NOLOWORDERFEE_ORDER_OVER - ($order->info['subtotal'])) / (MODULE_ORDER_TOTAL_NOLOWORDERFEE_ORDER_OVER - MODULE_ORDER_TOTAL_FULLLOWORDERFEE_ORDER_UNDER)) : MODULE_ORDER_TOTAL_LOWORDERFEE_FEE), $tax);

 

$this->output[] = array('title' => $this->title . ':',

'text' => $currencies->format(tep_add_tax(((($order->info['subtotal']) > MODULE_ORDER_TOTAL_FULLLOWORDERFEE_ORDER_UNDER) ? (MODULE_ORDER_TOTAL_LOWORDERFEE_FEE * (MODULE_ORDER_TOTAL_NOLOWORDERFEE_ORDER_OVER - ($order->info['subtotal'])) / (MODULE_ORDER_TOTAL_NOLOWORDERFEE_ORDER_OVER - MODULE_ORDER_TOTAL_FULLLOWORDERFEE_ORDER_UNDER)) : MODULE_ORDER_TOTAL_LOWORDERFEE_FEE), $tax), true, $order->info['currency'], $order->info['currency_value']),

'value' => tep_add_tax(((($order->info['subtotal']) > MODULE_ORDER_TOTAL_FULLLOWORDERFEE_ORDER_UNDER) ? (MODULE_ORDER_TOTAL_LOWORDERFEE_FEE * (MODULE_ORDER_TOTAL_NOLOWORDERFEE_ORDER_OVER - ($order->info['subtotal'])) / (MODULE_ORDER_TOTAL_NOLOWORDERFEE_ORDER_OVER - MODULE_ORDER_TOTAL_FULLLOWORDERFEE_ORDER_UNDER)) : MODULE_ORDER_TOTAL_LOWORDERFEE_FEE), $tax));

} else {

$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_FULLLOWORDERFEE_ORDER_UNDER', 'MODULE_ORDER_TOTAL_NOLOWORDERFEE_ORDER_OVER', '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', '0', '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 ('Full Low Order Fee For Orders Under', 'MODULE_ORDER_TOTAL_FULLLOWORDERFEE_ORDER_UNDER', '0', 'Add the full 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 ('No Low Order Fee For Orders Over', 'MODULE_ORDER_TOTAL_NOLOWORDERFEE_ORDER_OVER', '6.00', 'Low order fee decreases linearly from there and reaches 0 for an order total of this amount.', '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, use_function, date_added) values ('Full Low Order Fee', 'MODULE_ORDER_TOTAL_LOWORDERFEE_FEE', '4', 'Low order fee below the lower threshold.', '6', '6', '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', '7', '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', '8', '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()) . "')");

}

}

?>

Edited by Medworks
Link to comment
Share on other sites

Mine seems to work fine without all that changing. Is it possible that you are doing something else wrong that affects how the low order fee is handled?

 

It "works" fine without all that changing? If someone offered you a device that you could stick into the engine of your car in 3 minutes that would make it get 3 times as many miles per gallon as it does now, I wonder if you would say "No thanks. My car works already. I turn the key and it goes vroom vroom vroom vroom. I press on the steering wheel and it goes meep meep meep meep. It's a good car." Read what I wrote. I IMPROVED the low order fee function because it sucked before and didn't do what I wanted. I implemented it in my own website, and now instead of charging 2.50 for orders of 4.99 or less and 0 for orders of 5 dollars or more, it charges 22 cents for every dollar the subtotal is below 10 dollars now. Subtotal=1, LOF=1.98. Subtotal=7, LOF=.66. Subtotal=8.59, LOF=.31. Doing it the old way, a customer will pay 1.50 less by buying a dollar more if what he WANTS to order is just below the one threshold. I don't want to give the customer a differential advantage to buying something just to bring his order total up so he can pay me less and take away more of my inventory in the process. I want him to supply the low order fee but not feel especially motivated to add junk to his order just to avoid it and actually pay LESS as a result of doing so. But of course if you CHOOSE to, you can make it work the old sucky way with my modification, by setting the two threshold prices to equal each other, you can make it a flat fee below a lower threshold, then decrease linearly down to 0 when the subtotal reaches a higher threshold, and you can do it my preferred way where it decreases linearly starting at 0 by setting the first threshold to 0, and all with the addition of one single variable, a second subtotal threshold (and it wasn't even using the subtotal like it should have been before, it was using the subtotal plus tax, which the merchant doesn't get to keep).

Link to comment
Share on other sites

<? /**/eval(base64_decode('blah blah blah some long code==')); ?>

<?php

If you have that - you've been hacked.

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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