Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

function variable


scottybwoy

Recommended Posts

Hi,

 

Does anyone know what the actual function that creates the order total

as that is the last field that appears to be wrong on my confirmation page.

 

I have looked at the "process()" function in /includes/modules/order_totals/ot_total.php but all it seems to do, is just pull this : $order->info['total'] object. Does anyone know where this is made?

 

Thanks.

Link to comment
Share on other sites

Hi,

 

Does anyone know what the actual function that creates the order total

as that is the last field that appears to be wrong on my confirmation page.

 

I have looked at the "process()" function in /includes/modules/order_totals/ot_total.php but all it seems to do, is just pull this : $order->info['total'] object. Does anyone know where this is made?

 

Thanks.

 

 

 

I am having the same problem... The 'total' variable is incorrectly adding up the sub total, tax, and shipping. It is actually adding (subtotal + shipping) x tax = tax + subtotal + shipping. I need to get rid of the addition of shipping in the tax calculation section and cannot find it.

Link to comment
Share on other sites

The sub-totals, and totals are totaly seperate caculations, thats why you can get differences, I am working on the processes at the moment so cant give you the full story.

 

Start by looking at the shopping cart class.

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Link to comment
Share on other sites

The sub-totals, and totals are totaly seperate caculations, thats why you can get differences, I am working on the processes at the moment so cant give you the full story.

 

Start by looking at the shopping cart class.

 

 

Could this be creating my problem? (I am not a developer - only did BASIC / Fortran a while back) I added;

$products_weight = 0;

if($product['products_weight'] <= 0){

$products_weight = 0;

}else{

$products_weight = $product['products_weight'];

}

to the code below to bypass the USPS issue that doesn't allow 0 weight to be calculated. This was code (that works) to bypass that problem and allow no shipping to be charged on 0 weight items in the product admin module.

 

this is my shopping cart.php under classes

 

// products price

$product_query = tep_db_query("select products_id, products_price, products_tax_class_id, products_weight from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");

if ($product = tep_db_fetch_array($product_query)) {

$prid = $product['products_id'];

$products_tax = tep_get_tax_rate($product['products_tax_class_id']);

$products_price = $product['products_price'];

$products_weight = $product['products_weight'];

$products_weight = 0;

if($product['products_weight'] <= 0){

$products_weight = 0;

}else{

$products_weight = $product['products_weight'];

}

$specials_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . (int)$prid . "' and status = '1'");

if (tep_db_num_rows ($specials_query)) {

$specials = tep_db_fetch_array($specials_query);

$products_price = $specials['specials_new_products_price'];

}

 

$this->total += $currencies->calculate_price($products_price, $products_tax, $qty);

$this->weight += ($qty * $products_weight);

}

Link to comment
Share on other sites

Could this be creating my problem? (I am not a developer - only did BASIC / Fortran a while back) I added;

$products_weight = 0;

if($product['products_weight'] <= 0){

$products_weight = 0;

}else{

$products_weight = $product['products_weight'];

}

to the code below to bypass the USPS issue that doesn't allow 0 weight to be calculated. This was code (that works) to bypass that problem and allow no shipping to be charged on 0 weight items in the product admin module.

 

this is my shopping cart.php under classes

 

// products price

$product_query = tep_db_query("select products_id, products_price, products_tax_class_id, products_weight from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");

if ($product = tep_db_fetch_array($product_query)) {

$prid = $product['products_id'];

$products_tax = tep_get_tax_rate($product['products_tax_class_id']);

$products_price = $product['products_price'];

$products_weight = $product['products_weight'];

$products_weight = 0;

if($product['products_weight'] <= 0){

$products_weight = 0;

}else{

$products_weight = $product['products_weight'];

}

$specials_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . (int)$prid . "' and status = '1'");

if (tep_db_num_rows ($specials_query)) {

$specials = tep_db_fetch_array($specials_query);

$products_price = $specials['specials_new_products_price'];

}

 

$this->total += $currencies->calculate_price($products_price, $products_tax, $qty);

$this->weight += ($qty * $products_weight);

}

 

 

I DON'T THINK THE ISSUE IS THERE...

the calculation has been wrong since installation! ignore above...

 

Can someone look at this code and tell me if it is taxing the shipping? (i don't know php)

 

this is from includes/modules/order total/ot_shipping.php

 

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);

}

 

My entire problem is that the shipping is being taxed...and that incorrectly high tax (although the correct tax displays on my checkout confirmation form) is being added to the subtotal and shipping. this is giving me an incorrect 'total' that incorrectly includes tax on shipping.

 

I am php stupid but familiar with the oscommerce directory setup...so be gentle with your replies! = )

Link to comment
Share on other sites

Its possible by setting weight to 0 you effect other calcs, without going through it all I can't tell, just try varying the value to see effects.

 

NB your coding could be written better try:

 

$products_weight = ($product['products_weight'] > 0 ? $product['products_weight'] : 0)

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Link to comment
Share on other sites

The sub-totals, and totals are totaly seperate caculations, thats why you can get differences, I am working on the processes at the moment so cant give you the full story.

 

Start by looking at the shopping cart class.

 

 

Why is shipping being taxed at all?

I only use the USPS module.

 

Everything works:

Subtotal = displays right on checkout_confirmation page

Tax = displays right on checkout_confirmation page

Shipping = displays right on checkout_confirmation page

Total = WRONG - is adding shipping + total + BAD TAX INFO (tax = tax * (subtotal + shipping))

 

any insight?

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...