Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Page 1 of 2
Total amount not correct! 
 
Elect
Jr. Member
 
Total Posts:  1
Joined:  2009-08-20
 

Implemented the iDEAL module in Magento 1.3.2.2, but getting a problem when people order more then 1 of a product.
iDEAL gives an error message; ‘Totaalbedrag niet correct!’ (Total amount not correct).

Another users makes a note of this in the Reviews. So hopefully it can be fixed soon.

I’m using iDEAL Basic.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Websmurf
Jr. Member
 
Total Posts:  3
Joined:  2009-09-11
 

I can confirm this error.

I believe the issue is being caused by invalid tax calculations.

My client is entering prices including tax in their magento system.
Now, when proceeding to the checkout procedures, magento calculates the tax amounts. The issue comes down to rounding issues.

For example: I have a product which costs 109,95 including tax of which two are being ordered.

The last step in the single checkout phase is displaying:
Subtotal: € 184,79
Tax: € 35,11
End total: € 219,90

Which is in itself correct.

Now when we review the totals in the iDeal params, I notice the following:

&itemQuantity1;=2&itemPrice2;=3511&amount;=21990&itemQuantity2;=1&itemPrice1;=9239

I’ve stripped all other params

Now, when we recalculate the total amount based on the passed params we get the following:

1 * 3511 = 3511
2 * 9239 = 18478

3511 + 18478 = 21989

219,89 is not exactly the same as the real total amount which is 219,90

This results in the following error:
‘Totaalbedrag niet correct!’ (Total amount not correct).

Does anyone has a quick resolution to this?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Websmurf
Jr. Member
 
Total Posts:  3
Joined:  2009-09-11
 

ok, a small dirty hack to avoid this issue

open /app/code/core/Mage/Ideal/Model/Basic.php

find:

$i 1;
        foreach (
$order->getItemsCollection() as $item{
            $fields 
array_merge($fields, array(
                
"itemNumber".$i => $item->getSku(),
                
"itemDescription".$i => $item->getName(),
                
"itemQuantity".$i => $item->getQtyOrdered()*1,
                
"itemPrice".$i => $item->getBasePrice()*100
            
));
            
$i++;
        
}

        
if ($order->getBaseShippingAmount() > 0{
            $fields 
array_merge($fields, array(
                
"itemNumber".$i => $order->getShippingMethod(),
                
"itemDescription".$i => $order->getShippingDescription(),
                
"itemQuantity".$i => 1,
                
"itemPrice".$i => $order->getBaseShippingAmount()*100
            
));
            
$i++;
        
}

        
if ($order->getBaseTaxAmount() > 0{
            $fields 
array_merge($fields, array(
                
"itemNumber".$i => 'Tax',
                
"itemDescription".$i => '',
                
"itemQuantity".$i => 1,
                
"itemPrice".$i => $order->getBaseTaxAmount()*100
            
));
            
$i++;
        
}

And replace it with:

$i 1;
        
$total 0// hack by adam
        
foreach ($order->getItemsCollection() as $item{
            $fields 
array_merge($fields, array(
                
"itemNumber".$i => $item->getSku(),
                
"itemDescription".$i => $item->getName(),
                
"itemQuantity".$i => $item->getQtyOrdered()*1,
                
"itemPrice".$i => $item->getBasePrice()*100
            
));
            
$i++;
            
$total += (($item->getQtyOrdered()*1) * $item->getBasePrice()*100); // hack by adam
        
}

        
if ($order->getBaseShippingAmount() > 0{
            $fields 
array_merge($fields, array(
                
"itemNumber".$i => $order->getShippingMethod(),
                
"itemDescription".$i => $order->getShippingDescription(),
                
"itemQuantity".$i => 1,
                
"itemPrice".$i => $order->getBaseShippingAmount()*100
            
));
            
$i++;
            
$total += ($order->getBaseShippingAmount()*100); // hack by adam
        
}

        
if ($order->getBaseTaxAmount() > 0{
            
/* hack by adam to avoid â€˜Totaalbedrag niet correct!’ error */
            
$tax $order->getBaseTaxAmount()*100;
            
$diff = ($order->getBaseGrandTotal()*100) - ($total $order->getBaseTaxAmount()*100);
            
/* end hack */
            
$fields array_merge($fields, array(
                
"itemNumber".$i => 'Tax',
                
"itemDescription".$i => '',
                
"itemQuantity".$i => 1,
                
"itemPrice".$i => $order->getBaseTaxAmount()*100 $diff
            
));
            
$i++;
        
}

basically, what it does is add the difference of what it should be compared to what it is (1 cent or so) to the tax, fixing the calculation on the Ideal side

 
Magento Community Magento Community
Magento Community
Magento Community
 
KJKING
Jr. Member
 
Total Posts:  7
Joined:  2009-07-20
 

Great thx! This seems to work!

The only thing that doesn’t work is if you apply a discount code, the amount is not correct. Am i doing something wrong?

Thanks in advanced!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Nautica
Sr. Member
 
Avatar
Total Posts:  140
Joined:  2008-01-03
 

I allso have this problem not only with iDEAL but also with Paypal.
This occurs due to a bug in Magento that still is not repaired and posted ages ago to the bugtracker.
Magento does the stupid thing of rounding the amounts before adding them together.

e.g
This is the way it should be:
Ordered items= 52.50
Shipping costs=13.10
Subtotal ex tax=65.60
tax VAT 19% = 12.464
Totaal Incl tax=78.064 = rounded 78.06

Magento calculates it like this:

Ordered Items + 19% = 62.475 = rounded 62.48
Shipping cost + 19% = 15.589 = rounded 15.59
The two rounded amounts give a total of 78.07
now we have a difference of 0.01

just look here in the bugtracker: http://www.magentocommerce.com/bug-tracking/issue?issue=5454
I think if you round the amounts of ideal the same way the problem must be gone. Never tried it because in my opinion the bug needs to be repaired.
I tried it but there are so many files in the core that needs changed. I had the roundings corrected in my orders but not in invoices, shipping, creditnotes, so i missed a few files to change.
If i change so many files then at the first update the will be gone and it crazy to make a seperate extension for it.
The simple thing is that the rounding only needs to be done on the Grant-Total and not in calculations before that. Calculations need 4 decimals and then rounding at the end.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Appmerce
Guru
 
Avatar
Total Posts:  376
Joined:  2008-05-13
Amsterdam, The Netherlands
 

De genoemde oplossing is niet helemaal goed. De discount wordt vergeten.

De juiste oplossing is als volgt:

$total 0// hack by adam
        
foreach ($order->getItemsCollection() as $item{
            $fields 
array_merge($fields, array(
                
"itemNumber".$i => $item->getSku(),
                
"itemDescription".$i => $item->getName(),
                
"itemQuantity".$i => $item->getQtyOrdered()*1,
                
"itemPrice".$i => $item->getBasePrice()*100
            
));
            
$i++;
            
$total += (($item->getQtyOrdered()*1) * $item->getBasePrice()*100); // hack by adam
        
}

        
if ($order->getBaseShippingAmount() > 0{
            $fields 
array_merge($fields, array(
                
"itemNumber".$i => $order->getShippingMethod(),
                
"itemDescription".$i => $order->getShippingDescription(),
                
"itemQuantity".$i => 1,
                
"itemPrice".$i => $order->getBaseShippingAmount()*100
            
));
            
$i++;
            
$total += ($order->getBaseShippingAmount()*100); // hack by adam
        
}

       
// Morningtime: extra: eerst de discount, daarna pas de tax amount corrigeren
        
if ($order->getBaseDiscountAmount() > 0{
            $fields 
array_merge($fields, array(
                
"itemNumber".$i => 'Discount',
                
"itemDescription".$i => '',
                
"itemQuantity".$i => 1,
                
"itemPrice".$i => -$order->getBaseDiscountAmount()*100
            
));
            
$total -= ($order->getBaseDiscountAmount()*100); // hack by adam
            
$i++;
        
}

        
if ($order->getBaseTaxAmount() > 0{
            $tax 
$order->getBaseTaxAmount()*100;
            
$diff = ($order->getBaseGrandTotal()*100) - ($total $order->getBaseTaxAmount()*100);
            
$fields array_merge($fields, array(
                
"itemNumber".$i => 'Tax',
                
"itemDescription".$i => '',
                
"itemQuantity".$i => 1,
                
"itemPrice".$i => $order->getBaseTaxAmount()*100 $diff
            
));
            
$i++;
        
}

Update: vreemde tekens weggehaald

 
Magento Community Magento Community
Magento Community
Magento Community
 
robnnl
Jr. Member
 
Total Posts:  16
Joined:  2009-04-06
 

Hi Morningtime,

Hij werkt bij mij niet. In Dreamweaver is een groot deel van de code ook rood gekleurd ipv groen en blauw (in de originele versie met de eerste hek is het namelijk wel met groen en blauw).

Zou je de file kunnen posten?

 
Magento Community Magento Community
Magento Community
Magento Community
 
mikoloko
Member
 
Total Posts:  51
Joined:  2009-10-13
Netherlands
 

De “/” weghalen maakt jouw kleuren weer blauw en groen.

na het implementeren van de codes, geeft ideal vervolgens op de betaalpagina een foutmelding:

Betaling niet geslaagd of geannuleerd.
Betalen met iDEAL is nu niet mogelijk. Probeer het later nogmaals of betaal op een andere manier.

Iemand, enig idee hoe dit komt?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Fidelity
Member
 
Avatar
Total Posts:  49
Joined:  2007-09-20
 

Lijkt voor mij ook niet te werken. iDeal blijft aangeven dat het totaalbedrag niet correct is na de aanpassing van Morningtime wanneer ik een order doe met een kortingscode erbij.

Ik gebruik geen BTW, wellicht ligt het daar aan?

Gek genoeg pakt hij voor \"amount\" wel de goede waarde maar niet voor \"itemPrice1\" volgens de foutmelding die ik per email van iDeal terug krijg.

Iemand enig idee?

 
Magento Community Magento Community
Magento Community
Magento Community
 
McHummer
Jr. Member
 
Avatar
Total Posts:  28
Joined:  2010-01-03
Deventer
 

Hi MorningTime,

Alles uitgevoerd zoals keurig hierboven omschreven maar iDeal blijft hetzelfde probleem/melding geven: ‘Totaalbedrag komt niet overeen.’

Ik heb een 10% korting laten berekenen.

Subtotaal € 2,95
Verzending en afhandeling € 4,95
Korting (zomer10) € 0,30-
Eindtotaal € 7,60

Foutmelding van iDeal op de mail:

Request parameters: &paymentType;=ideal&itemPrice2;=495&itemNumber1;=PRODUCTNAAM&itemDescription2;=Verzendkosten TNT &urlError;=http://www.SHOP.nl/ideal/basic/failure/&itemNumber2;=flatrate_flatrate&itemDescription1;=PRODUCTNAAM&form;_key=xxxxxxxxxxxxx&urlSuccess;=http://www.SHOP.nl/ideal/basic/success/&currency;=EUR&itemPrice1;=295&urlCancel;=http://www.SHOP.nl/ideal/basic/cancel/&hash;=xxxxxxxxxxxxxxxxxxx&subID;=0&itemQuantity1;=1&validUntil;=2010-07-12T22:38:19.000Z&language;=nl&itemQuantity2;=1&merchantID;=xxxxxxxxxx&amount;=760&purchaseID;=xxxxxxxxxx&description;=Basis Shop View payment

List of errors:
Totaalbedrag niet juist
 
Magento Community Magento Community
Magento Community
Magento Community
 
emile_rdam
Sr. Member
 
Total Posts:  89
Joined:  2010-05-20
 

Iemand hier al een oplossing voor? Heb klanten die dus willen bestellen met de kortingscode en ideal laat het nu afweten (magento 1.4.1.1). Alvast dank,.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Bartzet
Jr. Member
 
Total Posts:  4
Joined:  2009-08-29
 

Ik ervaar ook het probleem dat ideal een foutmelding geeft bij het gebruik van kortingscodes

Wat mij ook opvalt is dat het kortingspercentage van het bruto bedrag afgehaald wordt wat natuurlijk niet echt logisch is voor niet zakelijke klanten.

 
Magento Community Magento Community
Magento Community
Magento Community
 
kaab
Jr. Member
 
Total Posts:  3
Joined:  2008-07-21
 

At first didn\’t work for me on 1.4.2 i got the message \"Bedrag moet een geldig nummer zijn.\”
This was due to a rounding issues see code below

// Morningtime: extra: eerst de discount, daarna pas de tax amount corrigeren
if ($order->getBaseDiscountAmount() > 0) {
$fields = array_merge($fields, array(
\"itemNumber\".$i => \’Discount\’,
\"itemDescription\".$i => \’\’,
\"itemQuantity\".$i => 1,
// \"itemPrice\".$i => -$order->getBaseDiscountAmount()*100
// adjustment for rounding issue
\"itemPrice\".$i => -ceil($order->getBaseDiscountAmount()*100)
));
$total -= ($order->getBaseDiscountAmount()*100); // hack by adam
$i++;

 
Magento Community Magento Community
Magento Community
Magento Community
 
Gardrak
Jr. Member
 
Total Posts:  1
Joined:  2010-09-28
 

Waar staat bij ideal de korting?
Als ik bij het formulier info van ideal kijk (http://www.rabobank.nl/images/handleiding_ideal_lite_2966321.pdf - bijlage A) zie ik nergens een kortings veld.
Als ik het goed begrijp geeft ideal een \\\"Totaal bedrag niet correct!\\\” fout als amount niet gelijk is aan de som van de delen.

Neem ik nu het error mailtje van McHummer dan kom je tegen

&itemPrice1;=295 (artikel)
&itemPrice2;=495 (verzendkosten)
&amount;=760 (totaal)

295 +495 = 790 wat niet gelijk is aan 760....  dus een fout…

Ik had hier een &itemPrice3;=-30 verwacht.. maar die is er niet.....
Ook wordt er geen 30 cent ingehouden op artikel of verzendkosten dus hoe moet iDeal weten dat er korting is gegeven?

 
Magento Community Magento Community
Magento Community
Magento Community
 
fsit
Jr. Member
 
Total Posts:  3
Joined:  2009-09-29
 

Hopefully someone can benefit from my experience. But I am not a programmer so I cannot guarantee if it is a 100% solution.

We are using the iDeal Basic extension (old version, not 1.4 version) of J!Code on a 1.4.1.1. shop of a client.
First of all the total amount bug appeared and was fixed by applying the hack mentioned on the forum.

Then some orders would generate the “Bedrag moet een geldig nummer zijn” error on the iDeal site. Maybe it is a combination of a migrated catalog or something else but for a fact, there was an item which appeared in the source code of the iDeal site just before entering the error state with the following value:
<input id=\"itemPrice1\" name=\"itemPrice1\" value=\"2220.25\" type=\"hidden\"/>

Which resulted in the total ammount being incorrect, meaning:
<input id=\"amount\" name=\"amount\" value=\"66030.25\" type=\"hidden\"/>

Basically, what I did was not apply the \’floor\’ or \’ceil\’ option but I used the \’round\’ function for every price, before it was calculated to cents:

In:
/app/code/community/Jcode/IdealBasic/Model/Basic.php

Like this:

\'amount\' => round($order->getBaseGrandTotal(),2)*100
and
\'itemPrice\'.$i => round($item->getBasePrice(), 2)*100

You can find more info about the round function here: http://php.net/manual/en/function.round.php

This fixed it for those errors which had previously failed without breaking the orders which were fine smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
Ischa
Jr. Member
 
Total Posts:  4
Joined:  2009-01-24
 

I found a solution for the ‘total amount not correct’ error by only using

$order->getBaseGrandTotal()

Discounts, taxes and shipping costs working also with multiple products.

Jcode IdealBasic Ing
Magento 1.4.1.1

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 1 of 2