Calculation error

25.01.2012 23:35
#1
tthdoc
Joomshopping forum user no avatar
Name: Steve
08.01.2012
Posts: 8
Quote
Calculation error

I posted this in the shipping/payment section, but have not gotten a response, so I will post it here. Here is the original post...

I notice there is a calculation error when I am applying a coupon. I put a coupon in with a value of 10%. When it goes to the shopping cart it says this:

Subtotal 34.95 USD
Discount -3.50 USD
Total 31.46 USD

The total should be 31.45. It appears it is rounding the coupon amount from 3.495 which makes it 3.50. This is fine if it used this amount and then subtracted it from 34.95. It appears it is using the full amount of 3.495 and subtracting, which would give a total of 31.455, and then again rounding it, which would give 31.46.

Just to check, I changed the quantity to 3, and here is the result:

Subtotal 104.85 USD
Discount -10.49 USD
Total 94.37 USD

Again, the total should be 94.36.

Can you point me to where the calculation is being done and perhaps give a code fix I could insert to correct this problem.

Thanks
Doc

 
27.01.2012 14:15
#2
tthdoc
Joomshopping forum user no avatar
Name: Steve
08.01.2012
Posts: 8
Quote
Aw: Calculation error

Can someone at least tell me what file this calculation is done in? I would really like to get this resolved.

Thanks,
Doc

 
27.01.2012 19:40
#3
webdesigner
(Support Team)
User webdesigner
Name: Admin
05.08.2010
Posts: 16480
Quote
Aw: Calculation error

components\com_jshopping\controllers\cart.php


code

function reloadRabatValue(){
$jshopConfig = &JSFactory::getConfig();

if($this->rabatt_type == 1) {
$this->rabatt_summ = $this->rabatt_value * $jshopConfig->currency_value; //value
} else {
$this->rabatt_summ = $this->rabatt_value / 100 * $this->getSummForCalculeDiscount(); //percent
}
}


replace to

function reloadRabatValue(){
$jshopConfig = &JSFactory::getConfig();

if($this->rabatt_type == 1) {
$this->rabatt_summ = $this->rabatt_value * $jshopConfig->currency_value; //value
} else {
$this->rabatt_summ = $this->rabatt_value / 100 * $this->getSummForCalculeDiscount(); //percent
}
$this->rabatt_summ = round($this->rabatt_summ, 2);
}



Letzte Ă„nderung: 27.01.2012 19:41
 
27.01.2012 20:25
#4
tthdoc
Joomshopping forum user no avatar
Name: Steve
08.01.2012
Posts: 8
Quote
Aw: Calculation error

Thanks for getting back to me. There is no code like you have here in that file. To make sure we are using the same versions, here is the information I can find. On the joomla component menu in about us, it says Version 3.3.2. In the file components/com_jshopping/controllers/cart.php, the top says:

* @version 3.3.0 10.12.2011
* @author MAXXmarketing GmbH
* @package Jshopping
* @copyright Copyright (C) 2010 webdesigner-profi.de. All rights reserved.
* @license GNU/GPL

I searched the term "function" and only came up with the following:

add()
view()
delete()
refresh()
discountsave()

No other functions are in this file.

Do I need to change to a different version?

Thanks again,
Doc

 
27.01.2012 21:32
#5
webdesigner
(Support Team)
User webdesigner
Name: Admin
05.08.2010
Posts: 16480
Quote
Aw: Calculation error

Sorry
components\com_jshopping\models\cart.php

 
28.01.2012 00:41
#6
tthdoc
Joomshopping forum user no avatar
Name: Steve
08.01.2012
Posts: 8
Quote
Aw: Calculation error

Thanks, worked like a charm!

Doc

 
Copyrights MAXXmarketing GmbH. All Rights Reserved