Skip to main content

Rounding Errors

More
12 years 9 months ago #135428 by MumsHealth
Rounding Errors was created by MumsHealth
-- HikaShop version -- : 2.2.2
-- Joomla version -- : 3.2
-- PHP version -- : 5.3.3
-- Browser(s) name and version -- : N/A
-- Error-message(debug-mod must be tuned on) -- : N/A

There appears to be a rounding mismatch with the paypal payment rounding and hikashops rounding. In hikashop the tax ($2.9375) is rounded down to $2.93. When I have "Send details of the order" on in the paypal payment option the figure that is sent to paypal is rounded up to $2.94. The problem with this is because the payments don't match hikashop automatically cancels the order.

Please Log in or Create an account to join the conversation.

More
12 years 9 months ago #135429 by MumsHealth
Replied by MumsHealth on topic Rounding Errors
If you want to try to reproduce this the setup I have is as follows:

2 products $24.95 each
Shipping $8.75
+ 5% tax on everything

Please Log in or Create an account to join the conversation.

More
12 years 9 months ago #135508 by nicolas
Replied by nicolas on topic Rounding Errors
Hi,

The issue is with PayPal which doesn't round properly the calculations. You have two potential solutions:
1. Turn back off the "send order details" option of the payment method as it is the case by default so that PayPal directly uses the total amount.
2. Toggle the "calculations rounding" option of the configuration so that HikaShop calculations are done the way PayPal does them.
The following user(s) said Thank You: MumsHealth

Please Log in or Create an account to join the conversation.

More
12 years 9 months ago #135520 by MumsHealth
Replied by MumsHealth on topic Rounding Errors
I turned the "calculations rounding" option on and it seems to have fixed the prices to match paypal.

The only problems I am having now are with the reports. When I try to do a sales report none of the prices are rounded. It just adds them all together and the final figure is quite far off from the actual amount of money collected. Is there any way to get the reports to round each transaction down (like it originally did when they were charged) or do I have to go into each individual order and change the amounts manually?

Please Log in or Create an account to join the conversation.

More
12 years 9 months ago - 12 years 9 months ago #135795 by MumsHealth
Replied by MumsHealth on topic Rounding Errors
Also if you try to display a table with tax data (image attached) the following error is returned.

0 SQL=SELECT SUM(prod.order_product_tax*prod.order_product_quantity) as Total, a.order_currency_id FROM jos_hikashop_order AS a LEFT JOIN jos_hikashop_order_product AS prod ON a.order_id=prod.order_id AND prod.order_product_tax > 0 LEFT JOIN jos_hikashop_order_product AS prod ON a.order_id=prod.order_id WHERE a.order_type='sale' AND a.order_created > 1384020571 AND a.order_created < 1386612571 GROUP BY a.order_currency_id

Last edit: 12 years 9 months ago by MumsHealth.

Please Log in or Create an account to join the conversation.

More
12 years 9 months ago #136126 by Jerome
Replied by Jerome on topic Rounding Errors
Hi,

Please use the "mysqli" driver for your Joomla 3, this database driver have some patch which give you a precise error message for the SQL query (the patch for the "mysql" driver will be in another Joomla 3 release).
Like that I don't see any particular problem in the query so the database error message will give us some precious information.

Regards,

Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

More
12 years 9 months ago #136283 by MumsHealth
Replied by MumsHealth on topic Rounding Errors
Changed it and the error is now.

1066 Not unique table/alias: 'prod' SQL=SELECT SUM(prod.order_product_tax*prod.order_product_quantity) as Total, a.order_currency_id FROM jos_hikashop_order AS a LEFT JOIN jos_hikashop_order_product AS prod ON a.order_id=prod.order_id AND prod.order_product_tax > 0 LEFT JOIN jos_hikashop_order_product AS prod ON a.order_id=prod.order_id WHERE a.order_type='sale' AND a.order_created > 1384282128 AND a.order_created < 1386874128 GROUP BY a.order_currency_id

Please Log in or Create an account to join the conversation.

More
12 years 9 months ago #136386 by Xavier
Replied by Xavier on topic Rounding Errors
Hi,

Thanks to try to edit the file "administrator/components/com_hikashop/classes/widget.php" function "data()"

And add the code:
Code:
if(!isset($leftjoin['order_product']))
Before each:
Code:
$leftjoin['order_product'] = ' LEFT JOIN '.hikashop_table('order_product').' AS prod ON prod.order_id = o.order_id ';

Please Log in or Create an account to join the conversation.

More
12 years 9 months ago #136441 by MumsHealth
Replied by MumsHealth on topic Rounding Errors
Added if(!isset($leftjoin)) in front of lines 620 and 634 but it didn't seem to change anything.
I probably just did it wrong as I know nothing about php.

Here is lines 616-623
Code:
if($setFilters){ if(isset($widget->widget_params->filters['cat.category_id'])){ if(($widget->widget_params->content=='customers' || $widget->widget_params->content=='partners')){ $leftjoin['order'] = ' LEFT JOIN '.hikashop_table('order').' AS o ON o.order_id = a.user_id '; if(!isset($leftjoin['order_product']))$leftjoin['order_product'] = ' LEFT JOIN '.hikashop_table('order_product').' AS prod ON prod.order_id = o.order_id '; }else{ if(!isset($leftjoin['order_product']))$leftjoin['order_product'] = ' LEFT JOIN '.hikashop_table('order_product').' AS prod ON prod.order_id = a.order_id '; }

And here are lines 631-639
Code:
if(isset($widget->widget_params->filters['prod.product_id'])){ if(($widget->widget_params->content=='customers' || $widget->widget_params->content=='partners')){ $leftjoin['order'] = ' LEFT JOIN '.hikashop_table('order').' AS o ON o.order_user_id = a.user_id '; if(!isset($leftjoin['order_product']))$leftjoin['order_product'] = ' LEFT JOIN '.hikashop_table('order_product').' AS prod ON prod.order_id = o.order_id '; }else{ if(!isset($leftjoin['order_product']))$leftjoin['order_product'] = ' LEFT JOIN '.hikashop_table('order_product').' AS prod ON prod.order_id = a.order_id '; } } }

Please Log in or Create an account to join the conversation.

More
12 years 6 months ago - 12 years 6 months ago #147224 by Xavier
Replied by Xavier on topic Rounding Errors
Hi,

Sorry for this very late reply.
Do you have solved the issue or found a way of doing what you want ?

If it is, sharing the solution could help the other users :)
Last edit: 12 years 6 months ago by Xavier.

Please Log in or Create an account to join the conversation.

More
12 years 6 months ago #147585 by MumsHealth
Replied by MumsHealth on topic Rounding Errors
I havent found a way to do this retroactivly but turning on "Round prices during calculations" under system>configuration>main>taxes seems to fix future orders

Please Log in or Create an account to join the conversation.

Time to create page: 0.250 seconds
Powered by Kunena Forum