NJT
NJT

Reputation: 334

Magento PayPal module showing wrong quantity at paypal's payment page

This is the issue that I'm facing:

A customer adds more than a quantity of 1 for a product and it shows the right quantity on the checkout page but on PayPal's payment page, it always shows a quantity of 1 although the row total is correct (correct qty ordered X price).

The right quantity, however, is shown next to the name when you hover over the name of the product. But in the item details below, it always shows 1.

I saw this same question asked here: https://magento.stackexchange.com/questions/14872/magento-order-quantity-shown-in-paypal-as-x-1-with-real-quantity-in-item-name but no one had a solution

Saw it asked here too: http://www.magentocommerce.com/boards/v/viewthread/296454/ and tried the answer posted by the user 'cnyc' and that's what gave me the right quantity to show up next to the name when hovering. Now I just need it to show up in the details below too.

As others have doubted, I too think the problem lies in Cart.php (app/code/core/Mage/Paypal/Model/) with this code:

// aggregate item price if item qty * price does not match row total
    if (($amount * $qty) != $salesItem->getBaseRowTotal()) {
       $amount = (float) $salesItem->getBaseRowTotal();
       $subAggregatedLabel = ' x' . $qty;
       $qty = 1;
    }

As the user dan jones, from the second link that I posted, has written, it could be because of a rounding off miscalcuation. But, as there is no tax calculation on our products I don't why the row total won't match the qty ordered X price. Has anyone else faced this issue and managed to fix it?

Upvotes: 2

Views: 911

Answers (1)

NJT
NJT

Reputation: 334

Ok. Managed to get a solution.

Basically the problem was how Magento converted our product price into US $. Since Magento stores 3 values after the decimal point, the rounding off was adding an extra cent to the price and that is why PayPal's condition was failing. This in turn, fires the condition and multiplies the price X qty and displays the right price but the quantity as 1. Apparently, this is by PayPal's design.

We managed to solve it by rounding off the value to two places, which was taken into the variable $amount, before the condition fired. This made it bypass PayPal's condition and gave the right order details on PayPal's page.

Sorry if my answer is a lil all over the place. Wanted to quicky let anyone know of the solution we had. If anyone needs more info, just message me.

Upvotes: 1

Related Questions