Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

shipping costs - double tax in order total


goxy

Recommended Posts

Posted

Hello,

 

i have problem with the calculations on checkout_comfirmation page. namely, shipping costs there are with double tax. it works properly if i switch-on the module "onepage check out", but if i switch it off in admin than is the problem.

for example the cost of flat option (incl 19% vat) is 8.50, but on checkout_comfirmation page, it is 10.11.

 

the sort order is:

 

Sub-Totaal: 64.95EUR

(Best Way): 10.11EUR <- it must be here 8.50

BTW 19%: 13.34EUR

Totaal: 75.06EUR

 

it doesn't help if i change sort order.

 

flat option has selected shipping zone "netherlands".

it is tax-zone with only nl in it.

 

 

thanks in advance

Posted

shipping code might be having some configuration to display and include tax while calculating.

 

Also order total considers tax as a seperate part.

 

Check on this.

 

Satish

Ask/Skype for Free osCommerce value addon/SEO suggestion tips for your site.

 

Check My About US For who am I and what My company does.

Posted

shipping code might be having some configuration to display and include tax while calculating.

 

Also order total considers tax as a seperate part.

 

Check on this.

 

Satish

 

 

thanks Satish

 

 

it is strange, the calculation is correct when i switch "onepagecheckout" module on. I think from that point that shipping en order total tax config are correct. i thought it is zone settings problem but not. what else i must check , have no idea anymore :(

Posted

the calculation is correct when i switch "onepagecheckout" module on.

 

this means Your custom mod has a call to some function that is creating this bug.

 

If You can post Your code might be the reason could be analyzed.

 

Satish

Ask/Skype for Free osCommerce value addon/SEO suggestion tips for your site.

 

Check My About US For who am I and what My company does.

Posted

the calculation is correct when i switch "onepagecheckout" module on.

 

this means Your custom mod has a call to some function that is creating this bug.

 

If You can post Your code might be the reason could be analyzed.

 

Satish

 

 

I have tired to remove "onepage checkou" but the problem still exist...thus it is not in that module.

 

Satish... which part of code you want to see?

Posted

checkout_comfirmation page.

I think else might have to look at all order total Modules as well.

 

Satish

Ask/Skype for Free osCommerce value addon/SEO suggestion tips for your site.

 

Check My About US For who am I and what My company does.

Posted

checkout_comfirmation page.

I think else might have to look at all order total Modules as well.

 

Satish

 

 

 

I think there is no changes in ot_shipping

 

 

 

<?php

/*

$Id: ot_shipping.php 1739 2007-12-20 00:52:16Z hpdl $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2007 osCommerce

 

Released under the GNU General Public License

*/

 

class ot_shipping {

var $title, $output;

 

function ot_shipping() {

$this->code = 'ot_shipping';

$this->title = MODULE_ORDER_TOTAL_SHIPPING_TITLE;

$this->description = MODULE_ORDER_TOTAL_SHIPPING_DESCRIPTION;

$this->enabled = ((MODULE_ORDER_TOTAL_SHIPPING_STATUS == 'true') ? true : false);

$this->sort_order = MODULE_ORDER_TOTAL_SHIPPING_SORT_ORDER;

 

$this->output = array();

}

 

function process() {

global $order, $currencies;

 

if (MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING == 'true') {

switch (MODULE_ORDER_TOTAL_SHIPPING_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_SHIPPING_FREE_SHIPPING_OVER) ) {

$order->info['shipping_method'] = FREE_SHIPPING_TITLE;

$order->info['total'] -= $order->info['shipping_cost'];

$order->info['shipping_cost'] = 0;

}

}

 

$module = substr($GLOBALS['shipping']['id'], 0, strpos($GLOBALS['shipping']['id'], '_'));

 

if (tep_not_null($order->info['shipping_method'])) {

if ($GLOBALS[$module]->tax_class > 0) {

$shipping_tax = tep_get_tax_rate($GLOBALS[$module]->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);

$shipping_tax_description = tep_get_tax_description($GLOBALS[$module]->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);

 

$order->info['tax'] += tep_calculate_tax($order->info['shipping_cost'], $shipping_tax);

$order->info['tax_groups']["$shipping_tax_description"] += tep_calculate_tax($order->info['shipping_cost'], $shipping_tax);

$order->info['total'] += tep_calculate_tax($order->info['shipping_cost'], $shipping_tax);

 

 

if (DISPLAY_PRICE_WITH_TAX == 'true') $order->info['shipping_cost'] += tep_calculate_tax($order->info['shipping_cost'] , $shipping_tax);

}

 

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

'text' => $currencies->format($order->info['shipping_cost'], true, $order->info['currency'], $order->info['currency_value']),

'value' => $order->info['shipping_cost']);

}

}

 

function check() {

if (!isset($this->_check)) {

$check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_ORDER_TOTAL_SHIPPING_STATUS'");

$this->_check = tep_db_num_rows($check_query);

}

 

return $this->_check;

}

 

function keys() {

return array('MODULE_ORDER_TOTAL_SHIPPING_STATUS', 'MODULE_ORDER_TOTAL_SHIPPING_SORT_ORDER', 'MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING', 'MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER', 'MODULE_ORDER_TOTAL_SHIPPING_DESTINATION');

}

 

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 Shipping', 'MODULE_ORDER_TOTAL_SHIPPING_STATUS', 'true', 'Do you want to display the order shipping cost?', '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_SHIPPING_SORT_ORDER', '2', '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 Free Shipping', 'MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING', 'false', 'Do you want to allow free shipping?', '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 ('Free Shipping For Orders Over', 'MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER', '50', 'Provide free shipping for orders over the set 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, set_function, date_added) values ('Provide Free Shipping For Orders Made', 'MODULE_ORDER_TOTAL_SHIPPING_DESTINATION', 'national', 'Provide free shipping for orders sent to the set destination.', '6', '5', 'tep_cfg_select_option(array(\'national\', \'international\', \'both\'), ', now())");

}

 

function remove() {

tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");

}

}

?>

  • 3 weeks later...
Posted

oh, I have still same problem, can somebody help me please.

 

i did some tests:

 

1) in checkout_comfirmation.php

 

I pasted this "echo $order->info['shipping_cost'];" before call to total modules. It looks like this:

 

 

echo $order->info['shipping_cost'];

 

if (MODULE_ORDER_TOTAL_INSTALLED) {

$order_total_modules->process();

echo $order_total_modules->output();

}

 

echo $order->info['shipping_cost'];

 

 

Now i can see first echo with correct amount and second with wrong (double tax)

there is nothing changed in the order total modules, they are original osc files.

 

2) If i finish checkout process, the correct shipping amount is to see in the invoice and in the mysql order_total table. wrong amount, with double tax, is only to see on the checkout_comfirmation.php page and this amount must be paid. The customer, thus, pay total amount with double tax on shipping cost and on another side see invoice with les amount he paid and correct shipping costs.

 

 

3) I have installed ship2pay and shipp in cart module. I have removed those modules but the problem still occur.

 

 

4) there are no changes on hosting provider side.

 

 

 

please advise :'(

Posted

There was another thread on "the cart that couldn't add straight" that was just resolved. It turns out that the customer ordered (by length) a quantity of 2.5, and the total was correctly calculated on that, but the cart displayed the quantity truncated to 2 (integer). You might check if that's what's going on here.

Posted

I am convinced "one page checkout" is the issue. I am having the same problem, and it started when I installed the contribution, but turned it off in the admin. I am in the process of removing it.

Posted

goxy

 

Check includes/classes/order.php

 

/* One Page Checkout - BEGIN */

// tax total fix start

$this->info['tax_groups']["$products_tax_description"] = ($products_tax / 100) * $shown_price + $this->info['shipping_tax'];

// tax total fix end

/* One Page Checkout - END */

 

The above line was the culprit on my site. Hope this helps.

Posted

goxy

 

Check includes/classes/order.php

 

/* One Page Checkout - BEGIN */

// tax total fix start

$this->info['tax_groups']["$products_tax_description"] = ($products_tax / 100) * $shown_price + $this->info['shipping_tax'];

// tax total fix end

/* One Page Checkout - END */

 

The above line was the culprit on my site. Hope this helps.

 

 

 

did you resolve problem with uninstall of one page checkout?

 

I have removed but the problem still occur. :(

Posted

did you resolve problem with uninstall of one page checkout?

 

I have removed but the problem still occur. :(

 

I don't know php so take my advice with a grain of salt.

 

Around line 300 on my order.php, I replaced all the lines between the modifications for Separate Pricing Per Customer with the lines in my back-up of order.php.

 

The first line of the block of code is:

 

$this->info['tax'] += $shown_price - ($shown_price / (($products_tax < 10) ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax)));

 

and ends with:

 

$index++;

}

 

When I did that, my site worked correctly again. Before this change, the tax was doubled and the tax wasn't added into the total for the order.

Posted

I don't know php so take my advice with a grain of salt.

 

Around line 300 on my order.php, I replaced all the lines between the modifications for Separate Pricing Per Customer with the lines in my back-up of order.php.

 

The first line of the block of code is:

 

$this->info['tax'] += $shown_price - ($shown_price / (($products_tax < 10) ? "1.0" . str_replace('.', '', $products_tax) : "1." . str_replace('.', '', $products_tax)));

 

and ends with:

 

$index++;

}

 

When I did that, my site worked correctly again. Before this change, the tax was doubled and the tax wasn't added into the total for the order.

 

 

My order.php is original file, it is not changed. You had probably problem with the Separate pricing per customer.

Posted

oh my god...i have found solution

 

 

this was a part to call "order total modules" in checkout_comfirmation.php

 

 

if (MODULE_ORDER_TOTAL_INSTALLED) {

$order_total_modules->process();

echo $order_total_modules->output();

}

 

i have removed $order_total_modules->process();

 

so it becomes

 

 

if (MODULE_ORDER_TOTAL_INSTALLED) {

echo $order_total_modules->output();

}

 

 

it is by the way original call to "order total module" and i have no idea which module needs it.

:)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...