I’ve had one of my worst days programming ever – which is a big call I know – but seriously after today I think no Magento bug will ever faze me again.
So for anyone Googling about Magento 1.4.2 and Google Checkout, here’s a couple of tips based on this bug report.
Flat Rate Google Checkout shipping
There’s a warning generated by Magento if you do not have all 3 flat rate options filled in:
Warning: number_format() expects parameter 1 to be double, string given |
The solution is to check if they are populated in the app/code/core/Mage/GoogleCheckout/Model/Api/Xml/Checkout.php
before sending them.
Weight-based Table Rate Merchant-calculated Callback
This was a killer, basically weight-based table rates fail with Merchant calculated callbacks because the callback code is not setting all the required values for the shipping rate calculation. The details and my fix workaround are in the bug report.
I’m actually not sure what the exact fix should be, I think having two similarly purposed functions not giving the same results is going to cause issues, not just here in the Google Checkout code but potentially in other places too.
For example I use a small extension for automatically applying the shipping calculation on the cart page called PRWD Auto Shipping – it’s very simple but effective.
However I think the same bug affects this extension too as it runs the code:
Mage::getSingleton('checkout/session')->getQuote() ->getShippingAddress()->collectShippingRates(); |
Which when using weight-based table rates will also not have the required weight value set, and fail to return rates where a collectTotals()
would.
General Google Checkout Debugging Tips
Here’s a couple of tips if you’re battling with Google Checkout in Magento 1.4.2.
- In 1.4.2 default GC logging is no longer to the database as was the case but now to
var/log/
- If you are having trouble with Google Checkout, take away moving parts until something works. For example with merchant calculations, if table rates are not working, try flat rates. If flat rates are not working via callback, try the direct Google Checkout API flat rates (these bypass the callback altogether). Remember to check the Google Checkout integration console too.
Hope that helps someone facing the same sort of terrible day I’ve had.
If anyone has some extra advice or feedback on that callback bug, I’d really appreciate a comment.
This and your post about merchant shipping tax has been really helpful, thanks for posting them.
i’m just trying to diagnose a problem associated with the shipping tax and i’m finding that the usual Mage::log doesn’t work in callback.php (no session??). how do you debug it?
i’m using magento 1.3.2.4