HummingbirdUK main logo

Coding solutions to business problems

About us

We use code to create solutions to business challenges, bottle-necks and headaches.

If you think your business has a problem that can be solved through code, we are happy to chat things through without any obligation.

Get in touch

Paypal express review problems in Magento

Home / Blog / Paypal express review problems in Magento

Written by Giles Bennett

A recent query from a client arose when customers were being presented with the right cart totals all the way through the checkout process, but on returning to the site from Paypal, on the review page they were presented with a grand total which was double what they were expecting.

On investigation we spotted that the site's top cart was collecting the quote totals with this bit of code :


$quote = Mage::getSingleton('checkout/cart')->getQuote();
$quote->collectTotals();
$quote->getShippingAddress()->collectTotals();

Further down the page, though, the quote's totals were being collected again, resulting in the doubling of the grand total (there was no shipping charge in this instance).

The code above was wrapped in an if clause which excluded it from being run on the cart page, or on Magento's standard checkout pages, like so :


if (!(Mage::app()->getRequest()->getControllerName()=='onepage') && !(Mage::app()->getRequest()->getControllerName()=='cart')) {

The controller name for the Paypal review page, however, was 'express' so the code wasn't being excluded on the review page, so the totals were being doubled. A quick tweak to the if clause :


if (!(Mage::app()->getRequest()->getControllerName()=='onepage') && !(Mage::app()->getRequest()->getControllerName()=='cart') && !(Mage::app()->getRequest()->getControllerName()=='express')) {

and things were back on track.

Author : Giles Bennett

About the author

Giles Bennett built his first website in 1996, and is old enough to miss Netscape Navigator. Initially a lawyer, he jumped ship to IT in 2008, and after 5 years as a freelancer, he founded HummingbirdUK in 2013. He can be reached by email at giles@hummingbirduk.com.